X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8907154c1a8a6882c6797d1f16393ddfb23e7f3a..eea4d01c65f9b29baa1193db762b4c6b8144af24:/src/cocoa/taskbar.mm

diff --git a/src/cocoa/taskbar.mm b/src/cocoa/taskbar.mm
index 78bc7c5747..b48ecd30d1 100644
--- a/src/cocoa/taskbar.mm
+++ b/src/cocoa/taskbar.mm
@@ -311,8 +311,9 @@ bool wxTaskBarIconCustomStatusItemImpl::RemoveIcon()
 
 bool wxTaskBarIconCustomStatusItemImpl::PopupMenu(wxMenu *menu)
 {
-    wxASSERT(menu);
-    menu->SetInvokingWindow(m_iconWindow);
+    wxCHECK_MSG(menu, false, "can't popup a NULL menu");
+
+    wxMenuInvokingWindowSetter setInvokingWin(*menu, m_iconWindow);
     menu->UpdateUI();
 
     if([m_cocoaNSStatusItem respondsToSelector:@selector(popUpStatusItemMenu:)])
@@ -328,7 +329,6 @@ bool wxTaskBarIconCustomStatusItemImpl::PopupMenu(wxMenu *menu)
             eventNumber:0 clickCount:1 pressure:0.0];
         [NSMenu popUpContextMenu:menu->GetNSMenu() withEvent:nsevent forView:m_iconWindow->GetNSView()];
     }
-    menu->SetInvokingWindow(NULL);
     return true;
 }
 
@@ -390,7 +390,7 @@ void wxTaskBarIconWindowCustom::OnPaint(wxPaintEvent &event)
 
 // This neatly solves the problem of DLL separation.  If the wxAdvanced
 // library (which this file is part of) is loaded then this category is
-// defined and we get dock menu behavior without app.mm ever having to
+// defined and we get dock menu behaviour without app.mm ever having to
 // know we exist.  C++ did sucketh so. :-)
 
 @interface wxNSApplicationDelegate(wxTaskBarIconNSApplicationDelegateCategory)