зеркало из https://github.com/mozilla/pjs.git
Mac menus destroying themselves more properly
This commit is contained in:
Родитель
c0846e6fc3
Коммит
2696d19618
|
@ -94,6 +94,32 @@ nsMenu::~nsMenu()
|
|||
NS_IF_RELEASE(mMenuBarParent);
|
||||
NS_IF_RELEASE(mMenuParent);
|
||||
NS_IF_RELEASE(mListener);
|
||||
|
||||
while(mNumMenuItems)
|
||||
{
|
||||
--mNumMenuItems;
|
||||
|
||||
// Figure out what we're releasing
|
||||
nsIMenuItem * menuitem = nsnull;
|
||||
((nsISupports*)mMenuItemVoidArray[mNumMenuItems])->QueryInterface(kIMenuItemIID, (void**) &menuitem);
|
||||
if(menuitem)
|
||||
{
|
||||
// case menuitem
|
||||
NS_RELEASE(menuitem); // Release our hold
|
||||
NS_RELEASE(menuitem); // Balance QI
|
||||
}
|
||||
else
|
||||
{
|
||||
nsIMenu * menu = nsnull;
|
||||
((nsISupports*)mMenuItemVoidArray[mNumMenuItems])->QueryInterface(kIMenuIID, (void**) &menu);
|
||||
if(menu)
|
||||
{
|
||||
// case menu
|
||||
NS_RELEASE(menu); // Release our hold
|
||||
NS_RELEASE(menu); // Balance QI
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
|
@ -110,7 +110,6 @@ nsMenuBar::nsMenuBar() : nsIMenuBar(), nsIMenuListener()
|
|||
mOriginalMacMBarHandle = nsnull;
|
||||
mMacMBarHandle = nsnull;
|
||||
mMacMBarHandle = ::GetMenuBar(); // Get a copy of the menu list
|
||||
//::SetMenuBar(mMacMBarHandle); // Make the copy the current menu list
|
||||
::ClearMenuBar(); // Clear the copy
|
||||
}
|
||||
|
||||
|
@ -122,6 +121,13 @@ nsMenuBar::nsMenuBar() : nsIMenuBar(), nsIMenuListener()
|
|||
nsMenuBar::~nsMenuBar()
|
||||
{
|
||||
NS_IF_RELEASE(mParent);
|
||||
|
||||
while(mNumMenus)
|
||||
{
|
||||
--mNumMenus;
|
||||
nsIMenu* menu = (nsIMenu*)mMenuVoidArray[mNumMenus];
|
||||
NS_IF_RELEASE( menu );
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
Загрузка…
Ссылка в новой задаче