Skip to content

Commit

Permalink
Fix crash when removing tilemap in level editor (#3182)
Browse files Browse the repository at this point in the history
As pop_menu() in MenuManager frees the ObjectMenu which actually invoked
the pop_men(), m_object and all other members are not valid anymore.
Therefore, pop_menu() needs to be the last thing to call in the
menu_action.

Fixes #3117
  • Loading branch information
Brockengespenst authored Jan 28, 2025
1 parent 9161a95 commit 6cbef78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/editor/object_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ ObjectMenu::menu_action(MenuItem& item)
case MNID_REMOVE:
m_editor.delete_markers();
m_editor.m_reactivate_request = true;
MenuManager::instance().pop_menu();
m_object->remove_me();
MenuManager::instance().pop_menu();
break;

case MNID_REMOVEFUNCTION:
Expand Down

0 comments on commit 6cbef78

Please sign in to comment.