diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-01-28 15:31:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-28 15:31:43 +0100 |
commit | 89e7c2cb13c6f06eb376aae5e9354f4fabf01f3e (patch) | |
tree | 1ff8fb45819a19813951fa4613c0728059fa1708 | |
parent | 70689ebffd95ab34e45bcbfdce3f6389033bfd44 (diff) | |
parent | 402cfa983d1773b72cc69c63a9e3bccff285d0a4 (diff) |
Merge pull request #25415 from akien-mga/recursive-resource-assignments
Fix recursive assignment of Textures and other resources
-rw-r--r-- | scene/resources/font.cpp | 1 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 7ecf9a2b16..c72ccc97db 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -497,6 +497,7 @@ Size2 Font::get_string_size(const String &p_string) const { } void BitmapFont::set_fallback(const Ref<BitmapFont> &p_fallback) { + ERR_FAIL_COND(p_fallback == this); fallback = p_fallback; } diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index dcad70451e..ff5900cd3e 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -943,6 +943,7 @@ uint32_t AtlasTexture::get_flags() const { void AtlasTexture::set_atlas(const Ref<Texture> &p_atlas) { + ERR_FAIL_COND(p_atlas == this); if (atlas == p_atlas) return; atlas = p_atlas; @@ -1182,6 +1183,7 @@ void LargeTexture::set_piece_offset(int p_idx, const Point2 &p_offset) { void LargeTexture::set_piece_texture(int p_idx, const Ref<Texture> &p_texture) { + ERR_FAIL_COND(p_texture == this); ERR_FAIL_INDEX(p_idx, pieces.size()); pieces.write[p_idx].texture = p_texture; }; @@ -1747,6 +1749,7 @@ void ProxyTexture::_bind_methods() { void ProxyTexture::set_base(const Ref<Texture> &p_texture) { + ERR_FAIL_COND(p_texture == this); base = p_texture; if (base.is_valid()) { VS::get_singleton()->texture_set_proxy(proxy, base->get_rid()); @@ -1862,6 +1865,8 @@ int AnimatedTexture::get_frames() const { } void AnimatedTexture::set_frame_texture(int p_frame, const Ref<Texture> &p_texture) { + + ERR_FAIL_COND(p_texture == this); ERR_FAIL_INDEX(p_frame, MAX_FRAMES); RWLockWrite w(rw_lock); |