Fixed crash when removing a menu in the callback function that was called when the menu item was clicked