mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #5008 from OPM/avoid-virtual-method-constructors
Avoid virtual calls in constructor and desctructors
This commit is contained in:
commit
c7e97b4447
@ -41,8 +41,6 @@ RifEclipseRestartFilesetAccess::RifEclipseRestartFilesetAccess()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RifEclipseRestartFilesetAccess::~RifEclipseRestartFilesetAccess()
|
RifEclipseRestartFilesetAccess::~RifEclipseRestartFilesetAccess()
|
||||||
{
|
{
|
||||||
close();
|
|
||||||
|
|
||||||
for ( size_t i = 0; i < m_ecl_files.size(); i++ )
|
for ( size_t i = 0; i < m_ecl_files.size(); i++ )
|
||||||
{
|
{
|
||||||
if ( m_ecl_files[i] )
|
if ( m_ecl_files[i] )
|
||||||
|
@ -72,7 +72,8 @@ const RigFemPartGrid* RigFemPart::getOrCreateStructGrid() const
|
|||||||
{
|
{
|
||||||
if ( m_structGrid.isNull() )
|
if ( m_structGrid.isNull() )
|
||||||
{
|
{
|
||||||
m_structGrid = new RigFemPartGrid( this );
|
m_structGrid = new RigFemPartGrid();
|
||||||
|
m_structGrid->setFemPart( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_structGrid.p();
|
return m_structGrid.p();
|
||||||
|
@ -26,10 +26,9 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigFemPartGrid::RigFemPartGrid( const RigFemPart* femPart )
|
RigFemPartGrid::RigFemPartGrid()
|
||||||
|
: m_femPart( nullptr )
|
||||||
{
|
{
|
||||||
m_femPart = femPart;
|
|
||||||
generateStructGridData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -37,6 +36,15 @@ RigFemPartGrid::RigFemPartGrid( const RigFemPart* femPart )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigFemPartGrid::~RigFemPartGrid() {}
|
RigFemPartGrid::~RigFemPartGrid() {}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigFemPartGrid::setFemPart( const RigFemPart* femPart )
|
||||||
|
{
|
||||||
|
m_femPart = femPart;
|
||||||
|
generateStructGridData();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -26,9 +26,11 @@ class RigFemPart;
|
|||||||
class RigFemPartGrid : public cvf::StructGridInterface
|
class RigFemPartGrid : public cvf::StructGridInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit RigFemPartGrid( const RigFemPart* femPart );
|
RigFemPartGrid();
|
||||||
~RigFemPartGrid() override;
|
~RigFemPartGrid() override;
|
||||||
|
|
||||||
|
void setFemPart( const RigFemPart* femPart );
|
||||||
|
|
||||||
bool ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override;
|
bool ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override;
|
||||||
size_t cellIndexFromIJK( size_t i, size_t j, size_t k ) const override;
|
size_t cellIndexFromIJK( size_t i, size_t j, size_t k ) const override;
|
||||||
|
|
||||||
|
@ -116,7 +116,11 @@ RimFlowCharacteristicsPlot::~RimFlowCharacteristicsPlot()
|
|||||||
{
|
{
|
||||||
removeMdiWindowFromMdiArea();
|
removeMdiWindowFromMdiArea();
|
||||||
|
|
||||||
deleteViewWidget();
|
if ( m_flowCharPlotWidget )
|
||||||
|
{
|
||||||
|
m_flowCharPlotWidget->deleteLater();
|
||||||
|
m_flowCharPlotWidget = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -69,7 +69,11 @@ RimTofAccumulatedPhaseFractionsPlot::~RimTofAccumulatedPhaseFractionsPlot()
|
|||||||
{
|
{
|
||||||
removeMdiWindowFromMdiArea();
|
removeMdiWindowFromMdiArea();
|
||||||
|
|
||||||
deleteViewWidget();
|
if ( m_tofAccumulatedPhaseFractionsPlotWidget )
|
||||||
|
{
|
||||||
|
m_tofAccumulatedPhaseFractionsPlotWidget->deleteLater();
|
||||||
|
m_tofAccumulatedPhaseFractionsPlotWidget = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -57,7 +57,11 @@ RimTotalWellAllocationPlot::~RimTotalWellAllocationPlot()
|
|||||||
{
|
{
|
||||||
removeMdiWindowFromMdiArea();
|
removeMdiWindowFromMdiArea();
|
||||||
|
|
||||||
deleteViewWidget();
|
if ( m_wellTotalAllocationPlotWidget )
|
||||||
|
{
|
||||||
|
m_wellTotalAllocationPlotWidget->deleteLater();
|
||||||
|
m_wellTotalAllocationPlotWidget = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -140,7 +140,11 @@ RimWellAllocationPlot::~RimWellAllocationPlot()
|
|||||||
delete m_totalWellAllocationPlot();
|
delete m_totalWellAllocationPlot();
|
||||||
delete m_tofAccumulatedPhaseFractionsPlot();
|
delete m_tofAccumulatedPhaseFractionsPlot();
|
||||||
|
|
||||||
deleteViewWidget();
|
if ( m_wellAllocationPlotWidget )
|
||||||
|
{
|
||||||
|
m_wellAllocationPlotWidget->deleteLater();
|
||||||
|
m_wellAllocationPlotWidget = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -87,7 +87,7 @@ RimGridCrossPlot::RimGridCrossPlot()
|
|||||||
RimGridCrossPlot::~RimGridCrossPlot()
|
RimGridCrossPlot::~RimGridCrossPlot()
|
||||||
{
|
{
|
||||||
removeMdiWindowFromMdiArea();
|
removeMdiWindowFromMdiArea();
|
||||||
deleteViewWidget();
|
cleanupBeforeClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -481,12 +481,7 @@ QWidget* RimGridCrossPlot::createViewWidget( QWidget* mainWindowParent )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimGridCrossPlot::deleteViewWidget()
|
void RimGridCrossPlot::deleteViewWidget()
|
||||||
{
|
{
|
||||||
detachAllCurves();
|
cleanupBeforeClose();
|
||||||
if ( m_plotWidget )
|
|
||||||
{
|
|
||||||
m_plotWidget->deleteLater();
|
|
||||||
m_plotWidget = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1115,6 +1110,23 @@ void RimGridCrossPlot::updatePlotTitle()
|
|||||||
updateCurveNamesAndPlotTitle();
|
updateCurveNamesAndPlotTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridCrossPlot::cleanupBeforeClose()
|
||||||
|
{
|
||||||
|
for ( auto dataSet : m_crossPlotDataSets() )
|
||||||
|
{
|
||||||
|
dataSet->detachAllCurves();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_plotWidget )
|
||||||
|
{
|
||||||
|
m_plotWidget->deleteLater();
|
||||||
|
m_plotWidget = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Name Configuration
|
/// Name Configuration
|
||||||
///
|
///
|
||||||
|
@ -153,6 +153,9 @@ protected:
|
|||||||
|
|
||||||
void updatePlotTitle() override;
|
void updatePlotTitle() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void cleanupBeforeClose();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<bool> m_showInfoBox;
|
caf::PdmField<bool> m_showInfoBox;
|
||||||
caf::PdmField<bool> m_showLegend_OBSOLETE;
|
caf::PdmField<bool> m_showLegend_OBSOLETE;
|
||||||
|
@ -164,7 +164,8 @@ Rim3dView::~Rim3dView( void )
|
|||||||
}
|
}
|
||||||
removeMdiWindowFromMdiArea();
|
removeMdiWindowFromMdiArea();
|
||||||
|
|
||||||
deleteViewWidget();
|
delete m_viewer;
|
||||||
|
m_viewer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -66,7 +66,7 @@ RimGridPlotWindow::~RimGridPlotWindow()
|
|||||||
removeMdiWindowFromMdiArea();
|
removeMdiWindowFromMdiArea();
|
||||||
m_plots.deleteAllChildObjects();
|
m_plots.deleteAllChildObjects();
|
||||||
|
|
||||||
deleteViewWidget();
|
cleanupBeforeClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -387,13 +387,7 @@ QWidget* RimGridPlotWindow::createViewWidget( QWidget* mainWindowParent )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimGridPlotWindow::deleteViewWidget()
|
void RimGridPlotWindow::deleteViewWidget()
|
||||||
{
|
{
|
||||||
detachAllCurves();
|
cleanupBeforeClose();
|
||||||
|
|
||||||
if ( m_viewer )
|
|
||||||
{
|
|
||||||
m_viewer->deleteLater();
|
|
||||||
m_viewer = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -622,6 +616,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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -118,6 +118,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void detachAllCurves() override;
|
void detachAllCurves() override;
|
||||||
|
|
||||||
|
void cleanupBeforeClose();
|
||||||
|
|
||||||
static RimPlotInterface* toPlotInterfaceAsserted( caf::PdmObject* pdmObject );
|
static RimPlotInterface* toPlotInterfaceAsserted( caf::PdmObject* pdmObject );
|
||||||
static const RimPlotInterface* toPlotInterfaceAsserted( const caf::PdmObject* pdmObject );
|
static const RimPlotInterface* toPlotInterfaceAsserted( const caf::PdmObject* pdmObject );
|
||||||
static caf::PdmObject* toPdmObjectAsserted( RimPlotInterface* plotInterface );
|
static caf::PdmObject* toPdmObjectAsserted( RimPlotInterface* plotInterface );
|
||||||
|
@ -226,7 +226,7 @@ RimSummaryPlot::~RimSummaryPlot()
|
|||||||
{
|
{
|
||||||
removeMdiWindowFromMdiArea();
|
removeMdiWindowFromMdiArea();
|
||||||
|
|
||||||
deleteViewWidget();
|
cleanupBeforeClose();
|
||||||
|
|
||||||
m_summaryCurves_OBSOLETE.deleteAllChildObjects();
|
m_summaryCurves_OBSOLETE.deleteAllChildObjects();
|
||||||
m_curveFilters_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};
|
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()
|
void RimSummaryPlot::deleteViewWidget()
|
||||||
{
|
{
|
||||||
detachAllCurves();
|
cleanupBeforeClose();
|
||||||
|
|
||||||
if ( m_plotWidget )
|
|
||||||
{
|
|
||||||
m_plotWidget->deleteLater();
|
|
||||||
m_plotWidget = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -224,6 +224,8 @@ private:
|
|||||||
|
|
||||||
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
||||||
|
|
||||||
|
void cleanupBeforeClose();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<bool> m_normalizeCurveYValues;
|
caf::PdmField<bool> m_normalizeCurveYValues;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user