Files
ResInsight/ApplicationLibCode/UserInterface/RiuPlotUpdater.h
T
Magne Sjaastad d30d5e7817 Fix crashes reported by crash telemetry
* Use guarded pointer for delayed plot updates

The cached result definition can be deleted before the delayed update is
executed, causing a crash in the PVT and relative permeability plot panels.

* Guard against fracture definition without conductivity result

The list of conductivity result names is empty for some fracture
definitions, causing an out of range access when computing statistics.

* Guard against missing data source in custom VFP plot

The data source of a VFP table can be null, and the VFP tables are not
available until the data has been imported.
2026-08-07 12:14:03 +02:00

72 lines
2.6 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2024 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmPointer.h"
#include <QPointer>
#include <QString>
class RiuEclipseSelectionItem;
class RiuSelectionItem;
class Rim3dView;
class RimEclipseView;
class RigEclipseCaseData;
class RimEclipseResultDefinition;
class QWidget;
//==================================================================================================
//
//
//
//==================================================================================================
class RiuPlotUpdater
{
public:
RiuPlotUpdater();
void updateOnSelectionChanged( const RiuSelectionItem* selectionItem );
void updateOnTimeStepChanged( Rim3dView* changedView );
void doDelayedUpdate();
protected:
virtual void clearPlot() = 0;
virtual QWidget* plotPanel() = 0;
virtual bool queryDataAndUpdatePlot( const RimEclipseResultDefinition* eclipseResDef,
size_t timeStepIndex,
size_t gridIndex,
size_t gridLocalCellIndex ) = 0;
void storeDelayedInformation( const RiuEclipseSelectionItem* selItem );
void clearDelayedInformation();
static RiuEclipseSelectionItem* extractEclipseSelectionItem( const RiuSelectionItem* selectionItem, Rim3dView*& newFollowAnimView );
protected:
const Rim3dView* m_viewToFollowAnimationFrom;
// cached values for delayed plot updates
// Use a guarded pointer, as the result definition can be deleted before the delayed update is executed
caf::PdmPointer<RimEclipseResultDefinition> m_eclipseResultDef;
size_t m_timeStepIndex;
size_t m_gridIndex;
size_t m_gridLocalCellIndex;
};