#5007 Janitor : Do not call virtual methods from destructors

This commit is contained in:
Magne Sjaastad
2019-11-07 08:48:11 +01:00
parent 0caaaf7159
commit a413f672ec
12 changed files with 99 additions and 30 deletions

View File

@@ -66,7 +66,7 @@ RimGridPlotWindow::~RimGridPlotWindow()
removeMdiWindowFromMdiArea();
m_plots.deleteAllChildObjects();
deleteViewWidget();
cleanupBeforeClose();
}
//--------------------------------------------------------------------------------------------------
@@ -389,13 +389,7 @@ QWidget* RimGridPlotWindow::createViewWidget( QWidget* mainWindowParent )
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::deleteViewWidget()
{
detachAllCurves();
if ( m_viewer )
{
m_viewer->deleteLater();
m_viewer = nullptr;
}
cleanupBeforeClose();
}
//--------------------------------------------------------------------------------------------------
@@ -624,6 +618,24 @@ void RimGridPlotWindow::detachAllCurves()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::cleanupBeforeClose()
{
auto plotVector = plots();
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
{
plotVector[tIdx]->detachAllCurves();
}
if ( m_viewer )
{
m_viewer->deleteLater();
m_viewer = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------