mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-07 23:05:29 -06:00
#12535 Avoid use of caf::PdmPointer in async delete of objects
Remove the use of caf::PdmPointer in RifCalculatedSummaryCurveReader as these objects are only accessed and used only during the lifetime of the owning object. Move caching of RimProject::current()->calculationCollection() to the constructor instead of the calling site.
This commit is contained in:
1 parent
fe9cac4fba
commit
5ba4256e8b
5 files changed
+12
-19
No files matched your search
@@ -19,6 +19,8 @@
|
||||
#include "RimCalculatedSummaryCurveReader.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCalculation.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
#include "RimUserDefinedCalculation.h"
|
||||
@@ -26,9 +28,8 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifCalculatedSummaryCurveReader::RifCalculatedSummaryCurveReader( RimSummaryCalculationCollection* calculationCollection,
|
||||
RimSummaryCase* summaryCase )
|
||||
: m_calculationCollection( calculationCollection )
|
||||
RifCalculatedSummaryCurveReader::RifCalculatedSummaryCurveReader( RimSummaryCase* summaryCase )
|
||||
: m_calculationCollection( RimProject::current()->calculationCollection() )
|
||||
, m_summaryCase( summaryCase )
|
||||
{
|
||||
CAF_ASSERT( summaryCase );
|
||||
@@ -85,6 +86,8 @@ void RifCalculatedSummaryCurveReader::buildMetaData()
|
||||
{
|
||||
m_allResultAddresses.clear();
|
||||
|
||||
if ( !m_calculationCollection || !m_summaryCase ) return;
|
||||
|
||||
for ( RimUserDefinedCalculation* calc : m_calculationCollection->calculations() )
|
||||
{
|
||||
auto* sumCalc = dynamic_cast<RimSummaryCalculation*>( calc );
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class RifCalculatedSummaryCurveReader;
|
||||
class RimSummaryCalculation;
|
||||
class RimSummaryCalculationCollection;
|
||||
@@ -33,7 +31,7 @@ class RimSummaryCalculationCollection;
|
||||
class RifCalculatedSummaryCurveReader : public RifSummaryReaderInterface
|
||||
{
|
||||
public:
|
||||
explicit RifCalculatedSummaryCurveReader( RimSummaryCalculationCollection* calculationCollection, RimSummaryCase* summaryCase );
|
||||
explicit RifCalculatedSummaryCurveReader( RimSummaryCase* summaryCase );
|
||||
|
||||
std::vector<time_t> timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
std::pair<bool, std::vector<double>> values( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
@@ -47,6 +45,6 @@ private:
|
||||
RimSummaryCalculation* findCalculationByName( const RifEclipseSummaryAddress& resultAddress ) const;
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimSummaryCalculationCollection> m_calculationCollection;
|
||||
caf::PdmPointer<RimSummaryCase> m_summaryCase;
|
||||
RimSummaryCalculationCollection* m_calculationCollection;
|
||||
RimSummaryCase* m_summaryCase;
|
||||
};
|
||||
@@ -30,8 +30,6 @@
|
||||
#include "SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h"
|
||||
|
||||
#include "RimCalculatedSummaryCurveReader.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
|
||||
@@ -76,8 +74,7 @@ void RimCsvUserData::createSummaryReaderInterface()
|
||||
m_multiSummaryReader = new RifMultipleSummaryReaders;
|
||||
m_multiSummaryReader->addReader( m_summaryReader.p() );
|
||||
|
||||
RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection();
|
||||
m_calculatedSummaryReader = new RifCalculatedSummaryCurveReader( calcColl, this );
|
||||
m_calculatedSummaryReader = new RifCalculatedSummaryCurveReader( this );
|
||||
|
||||
m_multiSummaryReader->addReader( m_calculatedSummaryReader.p() );
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "RimCalculatedSummaryCurveReader.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimRftCase.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
@@ -113,8 +112,7 @@ void RimFileSummaryCase::createSummaryReaderInterfaceThreadSafe( RiaThreadSafeLo
|
||||
|
||||
openAndAttachAdditionalReader();
|
||||
|
||||
RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection();
|
||||
m_calculatedSummaryReader = new RifCalculatedSummaryCurveReader( calcColl, this );
|
||||
m_calculatedSummaryReader = new RifCalculatedSummaryCurveReader( this );
|
||||
|
||||
m_multiSummaryReader->addReader( m_calculatedSummaryReader.p() );
|
||||
}
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RimCalculatedSummaryCurveReader.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
|
||||
@@ -97,8 +95,7 @@ void RimObservedEclipseUserData::createSummaryReaderInterface()
|
||||
m_multiSummaryReader = new RifMultipleSummaryReaders;
|
||||
m_multiSummaryReader->addReader( m_summaryReader.p() );
|
||||
|
||||
RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection();
|
||||
m_calculatedSummaryReader = new RifCalculatedSummaryCurveReader( calcColl, this );
|
||||
m_calculatedSummaryReader = new RifCalculatedSummaryCurveReader( this );
|
||||
|
||||
m_multiSummaryReader->addReader( m_calculatedSummaryReader.p() );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user