From cf2410015412c3c73a28897f0dd7fb0d4e1a909d Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 26 Jan 2015 15:28:44 +0300 Subject: [PATCH] Fix for issue #362 : something wrong with references during the close action --- src/Model/Model_Document.cpp | 6 ++---- src/SketchSolver/SketchSolver_Constraint.cpp | 12 +++++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 3efd64be7..680b7fd3e 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -250,8 +250,7 @@ void Model_Document::close(const bool theForever) subDoc(*aSubIter)->close(theForever); // close for thid document needs no transaction in this document - if (this == aPM->moduleDocument().get()) - std::static_pointer_cast(Model_Session::get())->setCheckTransactions(false); + std::static_pointer_cast(Model_Session::get())->setCheckTransactions(false); // delete all features of this document std::shared_ptr aThis = @@ -282,8 +281,7 @@ void Model_Document::close(const bool theForever) myDoc->Close(); } - if (this == aPM->moduleDocument().get()) - std::static_pointer_cast(Model_Session::get())->setCheckTransactions(true); + std::static_pointer_cast(Model_Session::get())->setCheckTransactions(true); } void Model_Document::startOperation() diff --git a/src/SketchSolver/SketchSolver_Constraint.cpp b/src/SketchSolver/SketchSolver_Constraint.cpp index 88f4572a1..61a42b64c 100644 --- a/src/SketchSolver/SketchSolver_Constraint.cpp +++ b/src/SketchSolver/SketchSolver_Constraint.cpp @@ -229,11 +229,13 @@ AttrType typeOfAttribute(std::shared_ptr theAttribute) return ARC; } } else { - const std::string aType = anAttrRef->attr()->attributeType(); - if (aType == GeomDataAPI_Point2D::type()) - return POINT2D; - if (aType == GeomDataAPI_Point2D::type()) - return POINT2D; + if (anAttrRef->attr().get() != NULL) { + const std::string aType = anAttrRef->attr()->attributeType(); + if (aType == GeomDataAPI_Point2D::type()) + return POINT2D; + if (aType == GeomDataAPI_Point2D::type()) + return POINT2D; + } } return UNKNOWN; -- 2.39.2