From 3a620fe55d76c0704e91b12112105d04bcff85cf Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sat, 12 Feb 2011 14:46:58 +0100 Subject: [PATCH] Fix initial value for tied read-only properties --- simgear/props/props.cxx | 6 +++++- simgear/props/props.hxx | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/simgear/props/props.cxx b/simgear/props/props.cxx index fce6e8ab..12a8fe83 100644 --- a/simgear/props/props.cxx +++ b/simgear/props/props.cxx @@ -1615,8 +1615,12 @@ bool SGPropertyNode::tie (const SGRawValue &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; } diff --git a/simgear/props/props.hxx b/simgear/props/props.hxx index a80fc10a..e870f440 100644 --- a/simgear/props/props.hxx +++ b/simgear/props/props.hxx @@ -1786,8 +1786,12 @@ bool SGPropertyNode::tie(const SGRawValue &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; }