diff options
| author | Gilles Roudière <gilles.roudiere@gmail.com> | 2024-04-12 17:56:28 +0200 |
|---|---|---|
| committer | Gilles Roudière <gilles.roudiere@gmail.com> | 2024-04-12 17:56:28 +0200 |
| commit | bb6a1cb5a8b49de109d44d470deb38b625cd7fd8 (patch) | |
| tree | e9bdce5be155625c17f1e6c73d9b4698495b93ed | |
| parent | b2f425fe680d1ed5d5b5fa9ae289ae93fd294607 (diff) | |
| download | redot-engine-bb6a1cb5a8b49de109d44d470deb38b625cd7fd8.tar.gz | |
Fix heap-use-after-free error in TileMapLayerEditor
| -rw-r--r-- | editor/plugins/tiles/tile_map_layer_editor.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/editor/plugins/tiles/tile_map_layer_editor.cpp b/editor/plugins/tiles/tile_map_layer_editor.cpp index c00a6d99d3..e1a58a0998 100644 --- a/editor/plugins/tiles/tile_map_layer_editor.cpp +++ b/editor/plugins/tiles/tile_map_layer_editor.cpp @@ -3672,10 +3672,16 @@ void TileMapLayerEditor::_node_change(Node *p_node) { void TileMapLayerEditor::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_READY: { + case NOTIFICATION_ENTER_TREE: { get_tree()->connect("node_added", callable_mp(this, &TileMapLayerEditor::_node_change)); get_tree()->connect("node_removed", callable_mp(this, &TileMapLayerEditor::_node_change)); } break; + + case NOTIFICATION_EXIT_TREE: { + get_tree()->disconnect("node_added", callable_mp(this, &TileMapLayerEditor::_node_change)); + get_tree()->disconnect("node_removed", callable_mp(this, &TileMapLayerEditor::_node_change)); + } break; + case NOTIFICATION_THEME_CHANGED: { missing_tile_texture = get_editor_theme_icon(SNAME("StatusWarning")); warning_pattern_texture = get_editor_theme_icon(SNAME("WarningPattern")); |
