mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5007 Janitor : Do not call virtual methods from destructors
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user