mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 14:40:26 -05:00
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.
This commit is contained in:
1 parent
318659e130
commit
d30d5e7817
7 files changed
+100
-7
No files matched your search
@@ -0,0 +1,59 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RiuPlotUpdater.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class TestPlotUpdater : public RiuPlotUpdater
|
||||
{
|
||||
public:
|
||||
void storeSelection( const RiuEclipseSelectionItem* selectionItem ) { storeDelayedInformation( selectionItem ); }
|
||||
|
||||
int queryCount() const { return m_queryCount; }
|
||||
|
||||
protected:
|
||||
void clearPlot() override {}
|
||||
QWidget* plotPanel() override { return nullptr; }
|
||||
|
||||
bool queryDataAndUpdatePlot( const RimEclipseResultDefinition* eclipseResDef, size_t, size_t, size_t ) override
|
||||
{
|
||||
m_queryCount++;
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
int m_queryCount = 0;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// The result definition can be deleted between the selection change and the delayed update
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST( RiuPlotUpdaterTest, DelayedUpdateAfterResultDefinitionIsDeleted )
|
||||
{
|
||||
auto* resultDefinition = new RimEclipseResultDefinition;
|
||||
|
||||
RiuEclipseSelectionItem selectionItem( nullptr,
|
||||
resultDefinition,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
cvf::Color3f( 1.0f, 0.0f, 0.0f ),
|
||||
cvf::StructGridInterface::NO_FACE,
|
||||
cvf::Vec3d::ZERO );
|
||||
|
||||
TestPlotUpdater plotUpdater;
|
||||
plotUpdater.storeSelection( &selectionItem );
|
||||
|
||||
delete resultDefinition;
|
||||
|
||||
plotUpdater.doDelayedUpdate();
|
||||
|
||||
EXPECT_EQ( 0, plotUpdater.queryCount() );
|
||||
}
|
||||
Reference in new issue
Block a user