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:
parent
e96155fece
commit
c80e529021
2 changed files with 10 additions and 0 deletions
|
|
@ -25,6 +25,8 @@ public:
|
|||
|
||||
bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
|
||||
|
||||
virtual ~wxPopupWindow();
|
||||
|
||||
virtual void SetFocus() wxOVERRIDE;
|
||||
virtual bool Show(bool show = true) wxOVERRIDE;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,14 @@ bool wxPopupWindow::Create(wxWindow *parent, int 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
|
||||
{
|
||||
// we only honour the border flags, the others don't make sense for us
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue