Skip to content

Commit dae5109

Browse files
committed
Merge pull request godotengine#90583 from groud/fix_heap-use-after-free_error
Fix heap-use-after-free error in TileMapLayerEditor
2 parents c9a595a + bb6a1cb commit dae5109

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

editor/plugins/tiles/tile_map_layer_editor.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3672,10 +3672,16 @@ void TileMapLayerEditor::_node_change(Node *p_node) {
36723672

36733673
void TileMapLayerEditor::_notification(int p_what) {
36743674
switch (p_what) {
3675-
case NOTIFICATION_READY: {
3675+
case NOTIFICATION_ENTER_TREE: {
36763676
get_tree()->connect("node_added", callable_mp(this, &TileMapLayerEditor::_node_change));
36773677
get_tree()->connect("node_removed", callable_mp(this, &TileMapLayerEditor::_node_change));
36783678
} break;
3679+
3680+
case NOTIFICATION_EXIT_TREE: {
3681+
get_tree()->disconnect("node_added", callable_mp(this, &TileMapLayerEditor::_node_change));
3682+
get_tree()->disconnect("node_removed", callable_mp(this, &TileMapLayerEditor::_node_change));
3683+
} break;
3684+
36793685
case NOTIFICATION_THEME_CHANGED: {
36803686
missing_tile_texture = get_editor_theme_icon(SNAME("StatusWarning"));
36813687
warning_pattern_texture = get_editor_theme_icon(SNAME("WarningPattern"));

0 commit comments

Comments
 (0)