Memory Management : Fixes related to plot objects and curves

This commit is contained in:
Magne Sjaastad
2022-02-25 14:47:15 +01:00
parent 47a44a79df
commit 4693dc44ef
14 changed files with 128 additions and 60 deletions

View File

@@ -131,7 +131,6 @@ RimPlotCurve::~RimPlotCurve()
{
if ( m_plotCurve )
{
detach();
delete m_plotCurve;
m_plotCurve = nullptr;
}
@@ -1017,12 +1016,15 @@ void RimPlotCurve::detach( bool deletePlotCurve )
{
if ( m_plotCurve )
{
m_plotCurve->detach();
if ( deletePlotCurve )
{
delete m_plotCurve;
m_plotCurve = nullptr;
}
else
{
m_plotCurve->detach();
}
}
replotParentPlot();
@@ -1033,7 +1035,7 @@ void RimPlotCurve::detach( bool deletePlotCurve )
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::reattach()
{
if ( m_parentPlot ) attach( m_parentPlot );
if ( m_parentPlot && canCurveBeAttached() ) attach( m_parentPlot );
}
//--------------------------------------------------------------------------------------------------
@@ -1044,6 +1046,15 @@ bool RimPlotCurve::isSameCurve( const RiuPlotCurve* plotCurve ) const
return m_plotCurve == plotCurve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::deletePlotCurve()
{
delete m_plotCurve;
m_plotCurve = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------