From fc65bd92a6a737617f4368ff101176af38836098 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 10 Jan 2019 16:57:36 +0000 Subject: [PATCH] Fix leaks/crashes related to window scrollbars in wxQt Closes https://github.com/wxWidgets/wxWidgets/pull/1135 --- src/qt/window.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/qt/window.cpp b/src/qt/window.cpp index 1fb5f111f5..1732de3863 100644 --- a/src/qt/window.cpp +++ b/src/qt/window.cpp @@ -73,6 +73,11 @@ class wxQtInternalScrollBar : public wxQtEventSignalHandler< QScrollBar, wxWindo { public: wxQtInternalScrollBar(wxWindowQt *parent, wxWindowQt *handler ); + ~wxQtInternalScrollBar() + { + disconnect( this, &QScrollBar::actionTriggered, this, &wxQtInternalScrollBar::actionTriggered ); + disconnect( this, &QScrollBar::sliderReleased, this, &wxQtInternalScrollBar::sliderReleased ); + } void actionTriggered( int action ); void sliderReleased(); void valueChanged( int position ); @@ -263,6 +268,16 @@ wxWindowQt::~wxWindowQt() m_qtWindow->blockSignals(true); // Reset the pointer to avoid handling pending event and signals QtStoreWindowPointer( GetHandle(), NULL ); + if ( m_horzScrollBar ) + { + QtStoreWindowPointer( m_horzScrollBar, NULL ); + m_horzScrollBar->deleteLater(); + } + if ( m_vertScrollBar ) + { + QtStoreWindowPointer( m_vertScrollBar, NULL ); + m_vertScrollBar->deleteLater(); + } // Delete QWidget when control return to event loop (safer) m_qtWindow->deleteLater(); m_qtWindow = NULL;