#5276 Ensemble : Guard null pointer access causing crash

This commit is contained in:
Magne Sjaastad 2020-01-03 07:09:35 +01:00
parent b066703529
commit dffef1cf54
3 changed files with 7 additions and 2 deletions

View File

@ -185,7 +185,10 @@ RimEnsembleCurveSet::~RimEnsembleCurveSet()
if ( parentPlot && parentPlot->viewer() )
{
m_qwtPlotCurveForLegendText->detach();
parentPlot->viewer()->removeOverlayFrame( m_legendOverlayFrame );
if ( m_legendOverlayFrame )
{
parentPlot->viewer()->removeOverlayFrame( m_legendOverlayFrame );
}
}
if ( m_legendOverlayFrame )
{

View File

@ -1232,7 +1232,7 @@ void RimSummaryPlot::deleteCurves( const std::vector<RimSummaryCurve*>& curves )
if ( curveSet->curves().empty() )
{
if ( curveSet->colorMode() == RimEnsembleCurveSet::ColorMode::BY_ENSEMBLE_PARAM &&
m_plotWidget )
m_plotWidget && curveSet->legendFrame() )
{
m_plotWidget->removeOverlayFrame( curveSet->legendFrame() );
}

View File

@ -426,6 +426,8 @@ void RiuQwtPlotWidget::addOverlayFrame( RiuDraggableOverlayFrame* overlayFrame )
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::removeOverlayFrame( RiuDraggableOverlayFrame* overlayFrame )
{
CAF_ASSERT( overlayFrame );
overlayFrame->hide();
overlayFrame->setParent( nullptr );
m_overlayFrames.removeOne( overlayFrame );