Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix for the issue #1605 : optimization of undo/redo and abort processing
[modules/shaper.git]
/
src
/
Model
/
Model_AttributeString.cpp
diff --git
a/src/Model/Model_AttributeString.cpp
b/src/Model/Model_AttributeString.cpp
index d2bd6191aa87a8aa9dea0864c05792a5c776c577..773a8bef919fbeaf61988b4080f8da2512d0e13b 100644
(file)
--- a/
src/Model/Model_AttributeString.cpp
+++ b/
src/Model/Model_AttributeString.cpp
@@
-20,6
+20,8
@@
void Model_AttributeString::setValue(const std::string& theValue)
{
TCollection_ExtendedString aValue(theValue.c_str());
if (!myIsInitialized || myString->Get() != aValue) {
{
TCollection_ExtendedString aValue(theValue.c_str());
if (!myIsInitialized || myString->Get() != aValue) {
+ if (myString.IsNull())
+ myString = TDataStd_Name::Set(myLab, TCollection_ExtendedString());
myString->Set(aValue);
owner()->data()->sendAttributeUpdated(this);
}
myString->Set(aValue);
owner()->data()->sendAttributeUpdated(this);
}
@@
-27,15
+29,14
@@
void Model_AttributeString::setValue(const std::string& theValue)
std::string Model_AttributeString::value()
{
std::string Model_AttributeString::value()
{
+ if (myString.IsNull())
+ return ""; // not initialized
return TCollection_AsciiString(myString->Get()).ToCString();
}
Model_AttributeString::Model_AttributeString(TDF_Label& theLabel)
{
return TCollection_AsciiString(myString->Get()).ToCString();
}
Model_AttributeString::Model_AttributeString(TDF_Label& theLabel)
{
+ myLab = theLabel;
// check the attribute could be already presented in this doc (after load document)
myIsInitialized = theLabel.FindAttribute(TDataStd_Name::GetID(), myString) == Standard_True;
// check the attribute could be already presented in this doc (after load document)
myIsInitialized = theLabel.FindAttribute(TDataStd_Name::GetID(), myString) == Standard_True;
- if (!myIsInitialized) {
- // create attribute: not initialized by value yet, just empty string
- myString = TDataStd_Name::Set(theLabel, TCollection_ExtendedString());
- }
}
}