Skip to content

Commit

Permalink
Revert "#2873 Delegate deletion of summary cases to separate thread."
Browse files Browse the repository at this point in the history
This reverts commit 0089e0c.

Didn't intend this to go into dev now
  • Loading branch information
lindkvis committed May 22, 2018
1 parent 0089e0c commit 772e7ec
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 170 deletions.
7 changes: 3 additions & 4 deletions ApplicationCode/Commands/RicCloseSummaryCaseFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

#include "RiuPlotMainWindow.h"

#include "cafAsyncObjectDeleter.h"
#include "cafSelectionManager.h"

#include "cvfAssert.h"
Expand All @@ -51,7 +50,7 @@ void RicCloseSummaryCaseFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCloseSummaryCaseFeature::deleteSummaryCases(std::vector<RimSummaryCase*>& cases)
void RicCloseSummaryCaseFeature::deleteSummaryCases(const std::vector<RimSummaryCase*>& cases)
{
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();

Expand All @@ -67,13 +66,13 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases(std::vector<RimSummaryCase*>
summaryCase->firstAncestorOrThisOfTypeAsserted(summaryCaseMainCollection);

summaryCaseMainCollection->removeCase(summaryCase);
delete summaryCase;

summaryCaseMainCollection->updateAllRequiredEditors();
}

RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
mainPlotWindow->updateSummaryPlotToolBar();

caf::AsyncRawPointerVectorDeleter<RimSummaryCase> summaryCaseDeleter(std::move(cases));
}

//--------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion ApplicationCode/Commands/RicCloseSummaryCaseFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RicCloseSummaryCaseFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static void deleteSummaryCases(std::vector<RimSummaryCase*>& cases);
static void deleteSummaryCases(const std::vector<RimSummaryCase*>& cases);

protected:
// Overrides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ RimSummaryCaseCollection::RimSummaryCaseCollection()
//--------------------------------------------------------------------------------------------------
RimSummaryCaseCollection::~RimSummaryCaseCollection()
{
m_cases.deleteAllChildObjectsAsync();
m_cases.deleteAllChildObjects();
updateReferringCurveSets();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ RimSummaryCaseMainCollection::RimSummaryCaseMainCollection()
//--------------------------------------------------------------------------------------------------
RimSummaryCaseMainCollection::~RimSummaryCaseMainCollection()
{
m_cases.deleteAllChildObjectsAsync();
m_caseCollections.deleteAllChildObjectsAsync();
m_cases.deleteAllChildObjects();
m_caseCollections.deleteAllChildObjects();
}

//--------------------------------------------------------------------------------------------------
Expand Down
3 changes: 0 additions & 3 deletions Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ set( PROJECT_FILES
cafTristate.h
cafFilePath.cpp
cafFilePath.h
cafAsyncObjectDeleter.h
cafAsyncObjectDeleter.inl

)

add_library( ${PROJECT_NAME}
Expand Down
64 changes: 0 additions & 64 deletions Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafAsyncObjectDeleter.h

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ class PdmChildArrayField<DataType*> : public PdmChildArrayFieldHandle
virtual size_t size() const { return m_pointers.size(); }
virtual bool empty() const { return m_pointers.empty(); }
virtual void clear();
virtual void deleteAllChildObjects();
virtual void deleteAllChildObjectsAsync();
virtual void deleteAllChildObjects();
virtual void insertAt(int indexAfter, PdmObjectHandle* obj);
virtual PdmObjectHandle* at(size_t index);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "cafAsyncObjectDeleter.h"
#include "cafClassTypeName.h"
#include "cafPdmObjectHandle.h"

Expand Down Expand Up @@ -139,20 +138,6 @@ void PdmChildArrayField<DataType*>::deleteAllChildObjects()
m_pointers.clear();
}

//--------------------------------------------------------------------------------------------------
/// Transfers ownership of the objects pointed to a separate thread.
/// Then clears the container and lets the thread delete the objects.
//--------------------------------------------------------------------------------------------------
template<typename DataType>
void PdmChildArrayField<DataType*>::deleteAllChildObjectsAsync()
{
CAF_ASSERT(isInitializedByInitFieldMacro());

AsyncPdmPointerVectorDeleter<DataType> pointerDeleter(std::move(m_pointers));
CAF_ASSERT(m_pointers.empty()); // Object storage for m_pointers should be empty immediately.
}


//--------------------------------------------------------------------------------------------------
/// Removes the pointer at index from the container. Does not delete the object pointed to.
/// Todo: This implementation can't be necessary in the new regime. Should be to just remove
Expand Down

0 comments on commit 772e7ec

Please sign in to comment.