diff --git a/docs/user/interface/MenuItem.dox b/docs/user/interface/MenuItem.dox index 147a506296..cb2510fc3f 100644 --- a/docs/user/interface/MenuItem.dox +++ b/docs/user/interface/MenuItem.dox @@ -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 */ diff --git a/src/kits/interface/MenuItem.cpp b/src/kits/interface/MenuItem.cpp index c28ce3f732..2d49398c01 100644 --- a/src/kits/interface/MenuItem.cpp +++ b/src/kits/interface/MenuItem.cpp @@ -181,6 +181,9 @@ BMenuItem::Archive(BMessage* data, bool deep) const BMenuItem::~BMenuItem() { + if (fSuper != NULL) + fSuper->RemoveItem(this); + free(fLabel); delete fSubmenu; }