Fix crash when deleting a sub plot of a multi plot in console mode

RimMultiPlot::recreatePlotWidgets() dereferenced the viewer unconditionally. The viewer does not exist in console mode, so deleting a summary plot from Python through the generic PdmObject delete() crashed ResInsight in onChildDeleted(). Return early when there is no viewer, matching the other viewer accesses in RimMultiPlot.

Add Python regression tests for deleting a single summary plot inside a multi plot and for deleting a whole multi plot, and an example showing how project tree objects are removed with delete().
This commit is contained in:
Kristian Bendiksen committed 2026-09-07 14:11:02 +02:00
1 parent e85137db6e
commit 4e0abb456f
3 files changed
+82 -1

No files matched your search

@@ -885,7 +885,8 @@ void RimMultiPlot::updateZoom()
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::recreatePlotWidgets()
{
CAF_ASSERT( m_viewer );
// No viewer exists in console mode (e.g. when a sub plot is deleted from Python)
if ( !m_viewer ) return;
m_viewer->removeAllPlots();