From 40a6d74aaf206fbde506fad0fea20e92b24582f4 Mon Sep 17 00:00:00 2001 From: ali kettab Date: Wed, 27 Dec 2023 19:31:33 +0100 Subject: [PATCH] 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. --- src/qt/popupwin.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/qt/popupwin.cpp b/src/qt/popupwin.cpp index 1ebc46eb45..b9adaace09 100644 --- a/src/qt/popupwin.cpp +++ b/src/qt/popupwin.cpp @@ -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 ); }