fixed crash when no wx menubar is created
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25950 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -335,14 +335,17 @@ static pascal OSStatus
|
|||||||
MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||||
{
|
{
|
||||||
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar();
|
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar();
|
||||||
wxFrame* win = mbar->GetFrame();
|
|
||||||
|
|
||||||
|
if ( mbar )
|
||||||
|
{
|
||||||
|
wxFrame* win = mbar->GetFrame();
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
|
|
||||||
// VZ: we could find the menu from its handle here by examining all
|
// VZ: we could find the menu from its handle here by examining all
|
||||||
// the menus in the menu bar recursively but knowing that neither
|
// the menus in the menu bar recursively but knowing that neither
|
||||||
// wxMSW nor wxGTK do it why bother...
|
// wxMSW nor wxGTK do it why bother...
|
||||||
#if 0
|
#if 0
|
||||||
MenuRef menuRef;
|
MenuRef menuRef;
|
||||||
|
|
||||||
GetEventParameter(event,
|
GetEventParameter(event,
|
||||||
@@ -350,7 +353,7 @@ MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
|||||||
typeMenuRef, NULL,
|
typeMenuRef, NULL,
|
||||||
sizeof(menuRef), NULL,
|
sizeof(menuRef), NULL,
|
||||||
&menuRef);
|
&menuRef);
|
||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
wxEventType type=0;
|
wxEventType type=0;
|
||||||
MenuCommand cmd=0;
|
MenuCommand cmd=0;
|
||||||
@@ -379,6 +382,7 @@ MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
|||||||
|
|
||||||
(void)win->GetEventHandler()->ProcessEvent(wxevent);
|
(void)win->GetEventHandler()->ProcessEvent(wxevent);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return eventNotHandledErr;
|
return eventNotHandledErr;
|
||||||
}
|
}
|
||||||
|
@@ -335,14 +335,17 @@ static pascal OSStatus
|
|||||||
MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||||
{
|
{
|
||||||
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar();
|
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar();
|
||||||
wxFrame* win = mbar->GetFrame();
|
|
||||||
|
|
||||||
|
if ( mbar )
|
||||||
|
{
|
||||||
|
wxFrame* win = mbar->GetFrame();
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
|
|
||||||
// VZ: we could find the menu from its handle here by examining all
|
// VZ: we could find the menu from its handle here by examining all
|
||||||
// the menus in the menu bar recursively but knowing that neither
|
// the menus in the menu bar recursively but knowing that neither
|
||||||
// wxMSW nor wxGTK do it why bother...
|
// wxMSW nor wxGTK do it why bother...
|
||||||
#if 0
|
#if 0
|
||||||
MenuRef menuRef;
|
MenuRef menuRef;
|
||||||
|
|
||||||
GetEventParameter(event,
|
GetEventParameter(event,
|
||||||
@@ -350,7 +353,7 @@ MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
|||||||
typeMenuRef, NULL,
|
typeMenuRef, NULL,
|
||||||
sizeof(menuRef), NULL,
|
sizeof(menuRef), NULL,
|
||||||
&menuRef);
|
&menuRef);
|
||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
wxEventType type=0;
|
wxEventType type=0;
|
||||||
MenuCommand cmd=0;
|
MenuCommand cmd=0;
|
||||||
@@ -379,6 +382,7 @@ MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
|||||||
|
|
||||||
(void)win->GetEventHandler()->ProcessEvent(wxevent);
|
(void)win->GetEventHandler()->ProcessEvent(wxevent);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return eventNotHandledErr;
|
return eventNotHandledErr;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user