#10349 Avoid calling performUpdate() in showEvent()

When a dock widget in a dock widget tab group is activated, a show event is triggered in IumMultiPlotBook::showEvent. This causes a crash if performUpdate is called in showEvent. Make sure the performUpdate is called from RimMultiPlot::onLoadDataAndUpdate()
This commit is contained in:
Magne Sjaastad 2023-06-06 09:20:29 +02:00
parent 3c526d888e
commit 14311dec3b
3 changed files with 15 additions and 1 deletions

View File

@ -805,6 +805,8 @@ void RimMultiPlot::onLoadDataAndUpdate()
RiuPlotMainWindowTools::refreshToolbars();
m_showPlotLegends = originalShowState;
if ( m_viewer ) m_viewer->forcePerformUpdate();
}
//--------------------------------------------------------------------------------------------------

View File

@ -399,7 +399,6 @@ void RiuMultiPlotBook::showEvent( QShowEvent* event )
m_goToPageAfterUpdate = true;
QWidget::showEvent( event );
performUpdate( RiaDefines::MultiPlotPageUpdateType::ALL );
if ( m_previewMode )
{
applyPagePreviewBookSize( width() );
@ -538,6 +537,14 @@ void RiuMultiPlotBook::updatePageTitles()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotBook::forcePerformUpdate()
{
performUpdate( RiaDefines::MultiPlotPageUpdateType::ALL );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -93,6 +93,11 @@ public:
void keepCurrentPageAfterUpdate();
// https://github.com/OPM/ResInsight/issues/10349
// This function is used to force an update of the plot book. It is intended to be used from RimMultiPlot::onLoadDataAndUpdate()
// The code used to be called from RiuMultiPlotBook::showEvent(), but this caused a crash when a dock widget was hidden and shown again.
void forcePerformUpdate();
protected:
void contextMenuEvent( QContextMenuEvent* ) override;