From 95c6d9cabace69901bc8e7f93ad611577fe89b74 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 8 Mar 2019 14:17:37 -0300 Subject: Fix crash in texture previeer, closes #26749, probably others --- editor/plugins/texture_editor_plugin.cpp | 5 +++++ editor/plugins/texture_editor_plugin.h | 1 + 2 files changed, 6 insertions(+) (limited to 'editor/plugins') diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index 6f9c9fa040..0aa4a7662c 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -138,6 +138,11 @@ TextureEditor::TextureEditor() { set_custom_minimum_size(Size2(1, 150)); } +TextureEditor::~TextureEditor() { + if (!texture.is_null()) { + texture->remove_change_receptor(this); + } +} // bool EditorInspectorPluginTexture::can_handle(Object *p_object) { diff --git a/editor/plugins/texture_editor_plugin.h b/editor/plugins/texture_editor_plugin.h index 9c7d33df5a..bcbda1fbd7 100644 --- a/editor/plugins/texture_editor_plugin.h +++ b/editor/plugins/texture_editor_plugin.h @@ -50,6 +50,7 @@ protected: public: void edit(Ref p_texture); TextureEditor(); + ~TextureEditor(); }; class EditorInspectorPluginTexture : public EditorInspectorPlugin { -- cgit v1.2.3