Fix crash when destroying wxPopupWindow without hiding it first
The global wxCurrentPopupWindow used by wxMSW wasn't reset in this case and resulted in a crash during the next mouse or focus event. Do it in wxPopupWindow dtor now, and not just when the popup is hidden.
This commit is contained in:
@@ -25,6 +25,8 @@ public:
|
|||||||
|
|
||||||
bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
|
bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
|
||||||
|
|
||||||
|
virtual ~wxPopupWindow();
|
||||||
|
|
||||||
virtual void SetFocus() wxOVERRIDE;
|
virtual void SetFocus() wxOVERRIDE;
|
||||||
virtual bool Show(bool show = true) wxOVERRIDE;
|
virtual bool Show(bool show = true) wxOVERRIDE;
|
||||||
|
|
||||||
|
@@ -59,6 +59,14 @@ bool wxPopupWindow::Create(wxWindow *parent, int flags)
|
|||||||
flags);
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxPopupWindow::~wxPopupWindow()
|
||||||
|
{
|
||||||
|
// If the popup is destroyed without being hidden first, ensure that we are
|
||||||
|
// not left with a dangling pointer.
|
||||||
|
if ( wxCurrentPopupWindow == this )
|
||||||
|
wxCurrentPopupWindow = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const
|
WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const
|
||||||
{
|
{
|
||||||
// we only honour the border flags, the others don't make sense for us
|
// we only honour the border flags, the others don't make sense for us
|
||||||
|
Reference in New Issue
Block a user