Create the wxPopupWindow with a parent under wxQt

The fact that we cannot create a wxPopupWindow with a parent
is no longer valid after the recent changes to the wxQt port.

The wxRichToolTip (an instance of wxPopupWindow) will crash if
created without a parent under this port.
This commit is contained in:
ali kettab 2023-12-27 19:31:33 +01:00
parent c7fdb41fcd
commit 40a6d74aaf

View file

@ -42,9 +42,9 @@ wxPopupWindow::wxPopupWindow(wxWindow *parent, int flags)
Create(parent, flags);
}
bool wxPopupWindow::Create( wxWindow *WXUNUSED(parent), int style )
bool wxPopupWindow::Create( wxWindow *parent, int style )
{
m_qtWindow = new wxQtPopupWindow(nullptr, this);
m_qtWindow = new wxQtPopupWindow(parent, this);
m_qtWindow->setWindowFlag(Qt::Popup);
m_qtWindow->setFocusPolicy(Qt::NoFocus);
@ -55,7 +55,6 @@ bool wxPopupWindow::Create( wxWindow *WXUNUSED(parent), int style )
// Unlike windows, top level windows are created hidden by default.
m_isShown = false;
// Under wxQt, popups should be created without parent. Otherwise, the
// application would crash (caused by double deletion) when it's shut down.
return wxPopupWindowBase::Create( nullptr, style );
return wxPopupWindowBase::Create(parent, style) &&
wxWindow::Create( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
}