backport, fixes #16564
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@77716 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -46,6 +46,8 @@ wxMenuImpl::~wxMenuImpl()
|
||||
// the (popup) menu title has this special menuid
|
||||
static const int idMenuTitle = -3;
|
||||
|
||||
wxScopedPtr<wxMenu> gs_emptyMenuBar;
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
@@ -73,7 +75,18 @@ void wxMenu::Init()
|
||||
|
||||
wxMenu::~wxMenu()
|
||||
{
|
||||
delete m_peer;
|
||||
#if wxOSX_USE_CARBON
|
||||
// when destroying the empty menu bar from the static scoped ptr
|
||||
// the peer destructor removes an association from an already deleted
|
||||
// hashmap leading to crashes. The guard avoids this, accepting some leaks...
|
||||
static bool finalmenubar = false;
|
||||
|
||||
if ( this == gs_emptyMenuBar.get() )
|
||||
finalmenubar = true;
|
||||
|
||||
if ( !finalmenubar )
|
||||
#endif
|
||||
delete m_peer;
|
||||
}
|
||||
|
||||
WXHMENU wxMenu::GetHMenu() const
|
||||
@@ -585,8 +598,6 @@ bool wxMenuBar::s_macAutoWindowMenu = true ;
|
||||
WXHMENU wxMenuBar::s_macWindowMenuHandle = NULL ;
|
||||
|
||||
|
||||
wxScopedPtr<wxMenu> gs_emptyMenuBar;
|
||||
|
||||
const int firstMenuPos = 1; // to account for the 0th application menu on mac
|
||||
|
||||
static wxMenu *CreateAppleMenu()
|
||||
|
Reference in New Issue
Block a user