Fix leaks/crashes related to window scrollbars in wxQt

Closes https://github.com/wxWidgets/wxWidgets/pull/1135
This commit is contained in:
Richard Smith
2019-01-10 16:57:36 +00:00
committed by Vadim Zeitlin
parent dfe0c27842
commit fc65bd92a6

View File

@@ -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;