From: sbh Date: Mon, 12 Jan 2015 17:24:32 +0000 (+0300) Subject: Resolve crashes in the release mode under Debian Squeeze linux X-Git-Tag: V_1.0.0~41 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=68a64bcea80af988b21026b3aadd9a6178d0d9c9;p=modules%2Fshaper.git Resolve crashes in the release mode under Debian Squeeze linux --- diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index 1ec015c90..0392787f3 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -42,8 +42,9 @@ void Model_ResultPart::activate() aDocRef->setValue(aDoc); } } - if (aDocRef->value()) + if (aDocRef->value().get()) { ModelAPI_Session::get()->setActiveDocument(aDocRef->value()); + } } bool Model_ResultPart::isActivated() diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index e30ddf142..05fe6e971 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -45,6 +45,10 @@ SET(PROJECT_SOURCES ModelAPI_Feature.cpp ModelAPI_Session.cpp ModelAPI_Tools.cpp + ModelAPI_Object.cpp + ModelAPI_Result.cpp + ModelAPI_ResultPart.cpp + ModelAPI_ResultConstruction.cpp ) SET(PROJECT_LIBRARIES diff --git a/src/ModelAPI/ModelAPI_Feature.h b/src/ModelAPI/ModelAPI_Feature.h index 452686cdb..a8ce3e94c 100644 --- a/src/ModelAPI/ModelAPI_Feature.h +++ b/src/ModelAPI/ModelAPI_Feature.h @@ -31,7 +31,7 @@ class ModelAPI_Feature : public ModelAPI_Object virtual const std::string& getKind() = 0; /// Returns the group identifier of all features - static std::string group() + inline static std::string group() { static std::string MY_GROUP = "Features"; return MY_GROUP; diff --git a/src/ModelAPI/ModelAPI_Object.cpp b/src/ModelAPI/ModelAPI_Object.cpp index 26bc46819..410c410c7 100644 --- a/src/ModelAPI/ModelAPI_Object.cpp +++ b/src/ModelAPI/ModelAPI_Object.cpp @@ -7,37 +7,46 @@ #include "ModelAPI_Object.h" -bool ModelAPI_Object::isInHistory() { +bool ModelAPI_Object::isInHistory() +{ return true; } -boost::shared_ptr ModelAPI_Object::data() const { +std::shared_ptr ModelAPI_Object::data() const +{ return myData; } -bool ModelAPI_Object::isSame(const boost::shared_ptr& theObject) { +bool ModelAPI_Object::isSame(const std::shared_ptr& theObject) +{ return theObject.get() == this; } -boost::shared_ptr ModelAPI_Object::document() const { +std::shared_ptr ModelAPI_Object::document() const +{ return myDoc; } -void ModelAPI_Object::attributeChanged() { +void ModelAPI_Object::attributeChanged(const std::string& theID) +{ } -ModelAPI_Object::~ModelAPI_Object() { +ModelAPI_Object::~ModelAPI_Object() +{ } -void ModelAPI_Object::setData(boost::shared_ptr theData) { +void ModelAPI_Object::setData(std::shared_ptr theData) +{ myData = theData; } -void ModelAPI_Object::setDoc(boost::shared_ptr theDoc) { +void ModelAPI_Object::setDoc(std::shared_ptr theDoc) +{ myDoc = theDoc; } -void ModelAPI_Object::erase() { +void ModelAPI_Object::erase() +{ if (myData) myData->erase(); setData(DataPtr()); } diff --git a/src/ModelAPI/ModelAPI_Object.h b/src/ModelAPI/ModelAPI_Object.h index 6d8aeaec8..45932c039 100644 --- a/src/ModelAPI/ModelAPI_Object.h +++ b/src/ModelAPI/ModelAPI_Object.h @@ -30,58 +30,37 @@ class ModelAPI_Object std::shared_ptr myDoc; ///< document this object belongs to public: /// By default object is displayed in the object browser. - virtual bool isInHistory() - { - return true; - } + MODELAPI_EXPORT virtual bool isInHistory(); /// Returns the data manager of this object: attributes - virtual std::shared_ptr data() const - { - return myData; - } + MODELAPI_EXPORT virtual std::shared_ptr data() const; /// Returns true if object refers to the same data model instance - virtual bool isSame(const std::shared_ptr& theObject) - { - return theObject.get() == this; - } + MODELAPI_EXPORT virtual bool isSame(const std::shared_ptr& theObject); /// Returns document this feature belongs to - virtual std::shared_ptr document() const - { - return myDoc; - } + MODELAPI_EXPORT virtual std::shared_ptr document() const; /// Returns the group identifier of this object virtual std::string groupName() = 0; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - MODELAPI_EXPORT virtual void attributeChanged(const std::string& theID) - {} + // MODELAPI_EXPORT + MODELAPI_EXPORT virtual void attributeChanged(const std::string& theID); /// To use virtuality for destructors - virtual ~ModelAPI_Object() {} + MODELAPI_EXPORT virtual ~ModelAPI_Object(); protected: /// Sets the data manager of an object (document does) - virtual void setData(std::shared_ptr theData) - { - myData = theData; - } + MODELAPI_EXPORT virtual void setData(std::shared_ptr theData); /// Sets the data manager of an object (document does) - virtual void setDoc(std::shared_ptr theDoc) - { - myDoc = theDoc; - } + MODELAPI_EXPORT virtual void setDoc(std::shared_ptr theDoc); /// removes all fields from this feature - MODELAPI_EXPORT virtual void erase() { - if (myData) myData->erase(); - setData(DataPtr()); - } + MODELAPI_EXPORT virtual void erase(); friend class Model_Document; diff --git a/src/ModelAPI/ModelAPI_Result.cpp b/src/ModelAPI/ModelAPI_Result.cpp index 743c0367b..aa5ddd227 100644 --- a/src/ModelAPI/ModelAPI_Result.cpp +++ b/src/ModelAPI/ModelAPI_Result.cpp @@ -6,16 +6,12 @@ #include "ModelAPI_Result.h" -bool ModelAPI_Result::isConcealed() { - return myIsConcealed; -} - -void ModelAPI_Result::setIsConcealed(const bool theValue) { - myIsConcealed = theValue; -} +ModelAPI_Result::~ModelAPI_Result() +{ -ModelAPI_Result::ModelAPI_Result() { } -ModelAPI_Result::~ModelAPI_Result() { +std::shared_ptr ModelAPI_Result::shape() +{ + return std::shared_ptr(); } diff --git a/src/ModelAPI/ModelAPI_Result.h b/src/ModelAPI/ModelAPI_Result.h index c354ed3a3..28ea36645 100644 --- a/src/ModelAPI/ModelAPI_Result.h +++ b/src/ModelAPI/ModelAPI_Result.h @@ -23,18 +23,22 @@ class ModelAPI_Result : public ModelAPI_Object bool myIsConcealed; ///< the result is concealed from the data tree (referenced by other objects) public: /// Returns true if the result is concealed from the data tree (referenced by other objects) - inline bool isConcealed() {return myIsConcealed;} + inline bool isConcealed() + { + return myIsConcealed; + } /// Returns true if the result is concealed from the data tree (referenced by other objects) - inline void setIsConcealed(const bool theValue) {myIsConcealed = theValue;} - - /// To virtually destroy the fields of successors - virtual ~ModelAPI_Result() + inline void setIsConcealed(const bool theValue) { + myIsConcealed = theValue; } + /// To virtually destroy the fields of successors + MODELAPI_EXPORT virtual ~ModelAPI_Result(); + /// Returns the shape-result produced by this feature (or null if no shapes) - virtual std::shared_ptr shape() {return std::shared_ptr();} + MODELAPI_EXPORT virtual std::shared_ptr shape(); }; //! Pointer on feature object diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index 61f90120c..7fce7f512 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -32,7 +32,7 @@ public: } /// Returns the group identifier of this result - static std::string group() + inline static std::string group() { static std::string MY_GROUP = "Bodies"; return MY_GROUP; diff --git a/src/ModelAPI/ModelAPI_ResultConstruction.cpp b/src/ModelAPI/ModelAPI_ResultConstruction.cpp new file mode 100644 index 000000000..5bf71d9a7 --- /dev/null +++ b/src/ModelAPI/ModelAPI_ResultConstruction.cpp @@ -0,0 +1,14 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: ModelAPI_ResultConstruction.cpp +// Created: 07 Jul 2014 +// Author: Mikhail PONIKAROV + +#include "ModelAPI_ResultConstruction.h" +#include + +std::string ModelAPI_ResultConstruction::groupName() +{ + return group(); +} + diff --git a/src/ModelAPI/ModelAPI_ResultConstruction.h b/src/ModelAPI/ModelAPI_ResultConstruction.h index 1092c4a9c..85a8d81ba 100644 --- a/src/ModelAPI/ModelAPI_ResultConstruction.h +++ b/src/ModelAPI/ModelAPI_ResultConstruction.h @@ -23,13 +23,10 @@ class ModelAPI_ResultConstruction : public ModelAPI_Result { public: /// Returns the group identifier of this result - virtual std::string groupName() - { - return group(); - } + MODELAPI_EXPORT virtual std::string groupName(); /// Returns the group identifier of this result - static std::string group() + inline static std::string group() { static std::string MY_GROUP = "Construction"; return MY_GROUP; diff --git a/src/ModelAPI/ModelAPI_ResultGroup.h b/src/ModelAPI/ModelAPI_ResultGroup.h index 8e55134ef..372cea121 100644 --- a/src/ModelAPI/ModelAPI_ResultGroup.h +++ b/src/ModelAPI/ModelAPI_ResultGroup.h @@ -28,7 +28,7 @@ public: } /// Returns the group identifier of this result - static std::string group() + inline static std::string group() { static std::string MY_GROUP = "Groups"; return MY_GROUP; diff --git a/src/ModelAPI/ModelAPI_ResultParameters.h b/src/ModelAPI/ModelAPI_ResultParameters.h index f9ed62ecb..3b8bd1535 100644 --- a/src/ModelAPI/ModelAPI_ResultParameters.h +++ b/src/ModelAPI/ModelAPI_ResultParameters.h @@ -26,7 +26,7 @@ class ModelAPI_ResultParameters : public ModelAPI_Result } /// Returns the group identifier of this result - static std::string group() + inline static std::string group() { static std::string MY_GROUP = "Parameters"; return MY_GROUP; diff --git a/src/ModelAPI/ModelAPI_ResultPart.cpp b/src/ModelAPI/ModelAPI_ResultPart.cpp new file mode 100644 index 000000000..9790051d7 --- /dev/null +++ b/src/ModelAPI/ModelAPI_ResultPart.cpp @@ -0,0 +1,14 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: ModelAPI_ResultPart.cpp +// Created: 12 Jan 2015 +// Author: Sergey BELASH + +#include + +#include + +std::string ModelAPI_ResultPart::groupName() +{ + return ModelAPI_ResultPart::group(); +} diff --git a/src/ModelAPI/ModelAPI_ResultPart.h b/src/ModelAPI/ModelAPI_ResultPart.h index ce1ea03af..11cae2bae 100644 --- a/src/ModelAPI/ModelAPI_ResultPart.h +++ b/src/ModelAPI/ModelAPI_ResultPart.h @@ -22,13 +22,10 @@ class ModelAPI_ResultPart : public ModelAPI_Result { public: /// Returns the group identifier of this result - virtual std::string groupName() - { - return group(); - } + MODELAPI_EXPORT virtual std::string groupName(); /// Returns the group identifier of this result - static std::string group() + inline static std::string group() { static std::string MY_GROUP = "Parts"; return MY_GROUP;