Fix initial value for tied read-only properties

This commit is contained in:
Torsten Dreyer 2011-02-12 14:46:58 +01:00
parent c684f8f043
commit 3a620fe55d
2 changed files with 10 additions and 2 deletions

View File

@ -1615,8 +1615,12 @@ bool SGPropertyNode::tie (const SGRawValue<const char *> &rawValue,
_tied = true;
_value.val = rawValue.clone();
if (useDefault)
if (useDefault) {
int save_attributes = getAttributes();
setAttribute( WRITE, true );
setStringValue(old_val.c_str());
setAttributes( save_attributes );
}
return true;
}

View File

@ -1786,8 +1786,12 @@ bool SGPropertyNode::tie(const SGRawValue<T> &rawValue, bool useDefault)
_type = EXTENDED;
_tied = true;
_value.val = rawValue.clone();
if (useDefault)
if (useDefault) {
int save_attributes = getAttributes();
setAttribute( WRITE, true );
setValue(old_val);
setAttributes( save_attributes );
}
return true;
}