From 824d5bd45811174c16732134aa63809c2f04ae1d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 4 Aug 2022 13:15:02 +0200 Subject: [PATCH] #9156 Use PdmPointer to avoid dangling pointer in Plot Editor --- .../Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp | 5 ++++- .../Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index 77b6641c07..71f903c9d3 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -164,7 +164,10 @@ void RicSummaryPlotEditorUi::updateFromSummaryPlot( RimSummaryPlot* if ( m_targetPlot ) { - targetPlot->firstAncestorOfType( m_plotContainer ); + RimSummaryMultiPlot* parentPlot = nullptr; + targetPlot->firstAncestorOfType( parentPlot ); + m_plotContainer = parentPlot; + populateCurveCreator( *m_targetPlot ); syncPreviewCurvesFromUiSelection(); setInitialCurveVisibility( targetPlot ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h index f88b4df977..ec027b8721 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h @@ -134,5 +134,5 @@ private: std::unique_ptr m_summaryCurveSelectionEditor; - RimSummaryMultiPlot* m_plotContainer; + caf::PdmPointer m_plotContainer; };