#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

@@ -226,7 +226,7 @@ RimSummaryPlot::~RimSummaryPlot()
{
removeMdiWindowFromMdiArea();
deleteViewWidget();
cleanupBeforeClose();
m_summaryCurves_OBSOLETE.deleteAllChildObjects();
m_curveFilters_OBSOLETE.deleteAllChildObjects();
@@ -1508,6 +1508,35 @@ std::set<RimPlotAxisPropertiesInterface*> RimSummaryPlot::allPlotAxes() const
return {m_timeAxisProperties, m_bottomAxisProperties, m_leftYAxisProperties, m_rightYAxisProperties};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::cleanupBeforeClose()
{
if ( m_summaryCurveCollection )
{
m_summaryCurveCollection->detachQwtCurves();
}
m_ensembleCurveSetCollection->detachQwtCurves();
for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves )
{
curve->detachQwtCurve();
}
for ( RimAsciiDataCurve* curve : m_asciiDataCurves )
{
curve->detachQwtCurve();
}
if ( m_plotWidget )
{
m_plotWidget->deleteLater();
m_plotWidget = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1736,13 +1765,7 @@ QWidget* RimSummaryPlot::createViewWidget( QWidget* mainWindowParent )
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::deleteViewWidget()
{
detachAllCurves();
if ( m_plotWidget )
{
m_plotWidget->deleteLater();
m_plotWidget = nullptr;
}
cleanupBeforeClose();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -224,6 +224,8 @@ private:
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
void cleanupBeforeClose();
private:
caf::PdmField<bool> m_normalizeCurveYValues;