Skip to content
Permalink
Browse files
BMenuItem: Remove ourselves from the super menu on destruct.
This fixes the (intermittently) crashing test added in the previous commit,
and should also fix #12024 and #14348.

Note that this is a slight behavioral departure from BeOS, though since
BeOS crashed when this was done previously, it shouldn't cause any
other problems.

Change-Id: I90b6132ff7741b8d6cb601375a9b11fc3ffacb40
Reviewed-on: https://review.haiku-os.org/541
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
  • Loading branch information
waddlesplash committed Sep 12, 2018
1 parent 4628b6d commit c3ac0a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
@@ -115,7 +115,9 @@
\fn BMenuItem::~BMenuItem()
\brief Destructor.

Also frees the memory used by the label or submenu.
If this item is attached to a menu, it will be removed from it.

Also destroys the label and submenu.

\since BeOS R3
*/
@@ -181,6 +181,9 @@ BMenuItem::Archive(BMessage* data, bool deep) const

BMenuItem::~BMenuItem()
{
if (fSuper != NULL)
fSuper->RemoveItem(this);

free(fLabel);
delete fSubmenu;
}

0 comments on commit c3ac0a7

Please sign in to comment.