diff --git a/src/qt/notebook.cpp b/src/qt/notebook.cpp index bb5750b6a3..0f4c2ae062 100644 --- a/src/qt/notebook.cpp +++ b/src/qt/notebook.cpp @@ -167,13 +167,22 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const bool wxNotebook::DeleteAllPages() { - if ( !wxNotebookBase::DeleteAllPages() ) - return false; + // Nothing to do if the notebook was not created yet, + // and return true just like other ports do. + if ( !m_qtTabWidget ) + return true; + // Block signals to not receive selection changed updates + // which are sent by Qt after the selected page was deleted. m_qtTabWidget->blockSignals(true); - m_qtTabWidget->clear(); + + // Pages will be deleted one by one in the base class. + // There's no need to explicitly clear() the Qt control. + bool deleted = wxNotebookBase::DeleteAllPages(); + m_qtTabWidget->blockSignals(false); - return true; + + return deleted; } int wxNotebook::SetSelection(size_t page)