Problem: Apparently when you add an alias to a property node, the
reference count of the target of the alias isn't incremented, so it
can vanish at any moment.
Fix: Since the SGPropertyNode class is hand managing its value
pointers anyway, I don't see much point in using SGPropertyNode_ptr
here, so I just called the SGReferenced get/put functions directly.
For all the unbelievers out there, I have verified that this in fact
happens. Though the instance I caught turned out to be harmless so I
omitted it here. I can try to find some more serious example if you
insist :)
--
Csaba/Jester
Index: simgear/props/props.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/props/props.cxx,v
retrieving revision 1.36
diff -u -r1.36 props.cxx
--- simgear/props/props.cxx 29 Jul 2008 08:25:18 -0000 1.36
+++ simgear/props/props.cxx 14 Jan 2009 04:20:13 -0000
@@ -477,6 +477,7 @@
case NONE:
break;
case ALIAS:
+ put(_value.alias);
_value.alias = 0;
break;
case BOOL:
@@ -661,6 +662,7 @@
break;
case ALIAS:
_value.alias = node._value.alias;
+ get(_value.alias);
_tied = false;
break;
case BOOL:
@@ -776,6 +778,7 @@
if (target == 0 || _type == ALIAS || _tied)
return false;
clearValue();
+ get(target);
_value.alias = target;
_type = ALIAS;
return true;
@@ -800,8 +803,7 @@
{
if (_type != ALIAS)
return false;
- _type = NONE;
- _value.alias = 0;
+ clearValue();
return true;
}
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel