X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/837e57436a89516a5fa9f478f401e06bd872c17c..48c12cb1290224f44161d9af774170d5f0fae440:/src/msw/taskbar.cpp diff --git a/src/msw/taskbar.cpp b/src/msw/taskbar.cpp index fdf563dc37..36d0de6c52 100644 --- a/src/msw/taskbar.cpp +++ b/src/msw/taskbar.cpp @@ -26,6 +26,7 @@ #include "wx/window.h" #include "wx/frame.h" #include "wx/utils.h" +#include "wx/menu.h" #endif #if defined(__WIN95__) && !defined(__TWIN32__) @@ -37,9 +38,11 @@ #ifndef __TWIN32__ #ifdef __GNUWIN32__ +#ifndef wxUSE_NORLANDER_HEADERS #include #endif #endif +#endif #ifdef __SALFORDC__ #include @@ -155,6 +158,16 @@ bool wxTaskBarIcon::RemoveIcon(void) bool wxTaskBarIcon::PopupMenu(wxMenu *menu) //, int x, int y); { + // OK, so I know this isn't thread-friendly, but + // what to do? We need this check. + + static bool s_inPopup = FALSE; + + if (s_inPopup) + return FALSE; + + s_inPopup = TRUE; + bool rval = FALSE; wxWindow* win; int x, y; @@ -164,10 +177,20 @@ bool wxTaskBarIcon::PopupMenu(wxMenu *menu) //, int x, int y); win = new wxFrame(NULL, -1, "", wxPoint(x,y), wxSize(-1,-1), 0); win->PushEventHandler(this); + // Remove from record of top-level windows, or will confuse wxWindows + // if we try to exit right now. + wxTopLevelWindows.DeleteObject(win); + + menu->UpdateUI(); + rval = win->PopupMenu(menu, 0, 0); win->PopEventHandler(FALSE); win->Destroy(); + delete win; + + s_inPopup = FALSE; + return rval; }