Summary plot crash fixes (#8595)

Disable assert for duplicated signal connections for now, just ignore everyone but the first one
Temp. workaround for crash when duplicating plot axis properties.
Update test
This commit is contained in:
jonjenssen 2022-03-01 17:27:46 +01:00 committed by GitHub
parent 9826d94e9a
commit 0cd965dd5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 14 deletions

View File

@ -2115,7 +2115,10 @@ void RimEnsembleCurveSet::initAfterRead()
if ( m_plotAxisProperties.value() == nullptr )
{
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted( plot );
m_plotAxisProperties = plot->axisPropertiesForPlotAxis( RiuPlotAxis( m_plotAxis_OBSOLETE() ) );
firstAncestorOrThisOfType( plot );
if ( plot )
{
m_plotAxisProperties = plot->axisPropertiesForPlotAxis( RiuPlotAxis( m_plotAxis_OBSOLETE() ) );
}
}
}

View File

@ -156,14 +156,14 @@ TEST( SignalTest, ObserverDeletion )
emitter.triggerBasicSignal();
}
TEST( SignalTest, ConnectSignalTwiceAssert )
{
ASSERT_DEATH(
{
TestEmitter emitter;
TestObserver observer;
observer.connectSignalsTwice( &emitter );
},
"" );
}
// TEST( SignalTest, ConnectSignalTwiceAssert )
//{
// ASSERT_DEATH(
// {
// TestEmitter emitter;
// TestObserver observer;
//
// observer.connectSignalsTwice( &emitter );
// },
// "" );
//}

View File

@ -137,7 +137,8 @@ public:
"Only classes that inherit SignalObserver can connect as an observer of a Signal." );
// Connecting a signal twice is not supported
CAF_ASSERT( m_observerCallbacks.find( observer ) == m_observerCallbacks.end() );
// CAF_ASSERT( m_observerCallbacks.find( observer ) == m_observerCallbacks.end() );
if ( m_observerCallbacks.find( observer ) != m_observerCallbacks.end() ) return;
m_observerCallbacks[observer] = std::make_pair( callback, true );
observer->addObservedSignal( this );