simgear/simgear/props
Julian Smith 1d978429f5 simgear/props/props.cxx: Avoid possible SEGV e.g. if listener removes itself.
simgear/props/props_test.cxx: test for self-unregister.

SGPropertyNode::removeChangeListener() used to modify the _listeners vector or
even delete it and set _listeners to NULL, if a listener was removed.

This could cause a SEGV if removeChangeListener() was called from
a listener, because listeners are called from methods such as
SGPropertyNode::fireValueChanged() which iterate through _listeners and don't
expect it to be changed to NULL.

The fix here is to keep a track of whether we are iterating through the
_listeners vector; if we are, SGPropertyNode::removeChangeListener() sets the
entry to NULL, instead of removing it.

We have a new internal function forEachListener() which takes
care of the iterating details - incrementing/decrementing the new
_listeners->_num_iterators count and skipping NULL entries. Before returning,
if _num_iterators is now zero it removes any NULL entries in the vector of
listeners.

The nListeners() member is no longer inline, because it needs to ignore NULL
entries in the vector. And _listeners now points to an internally-defined
struct which contains a new _num_iterators as well as the vector of listeners.

Added self-unregister test to simgear/props/props_test.cxx.
2020-06-13 18:11:49 +01:00
..
.gitignore PropertyObject enhancements, unit-test for make check 2010-11-20 02:49:04 -08:00
AtomicChangeListener.cxx Replace boost::bind by std::bind and lambda function 2020-04-22 14:04:21 +01:00
AtomicChangeListener.hxx Replace boost::bind by std::bind and lambda function 2020-04-22 14:04:21 +01:00
CMakeLists.txt Remove debug output (and shorten test names) 2013-04-26 00:13:35 +02:00
condition.cxx SGConditionRef typedef. No functional changes. 2014-06-22 15:35:31 +02:00
condition.hxx SGConditionRef typedef. No functional changes. 2014-06-22 15:35:31 +02:00
easing_functions_test.cxx Rename the COMPARE, COMPARE_EP, COMPARE_EP2 and VERIFY test macros 2016-12-04 21:04:40 +01:00
easing_functions.cxx Improve (mostly Canvas event related) documentation. 2014-07-29 23:57:59 +02:00
easing_functions.hxx New interpolation/animation system. 2013-03-15 23:37:17 +01:00
ExtendedPropertyAdapter.hxx Replace boost::bind by std::bind and lambda function 2020-04-22 14:04:21 +01:00
PropertyBasedElement.cxx canvas: Refactor with C++11 2018-01-28 00:49:05 +01:00
PropertyBasedElement.hxx canvas: Refactor with C++11 2018-01-28 00:49:05 +01:00
PropertyBasedMgr.cxx Replace BOOST_FOREACH by C++ 11 for range loop. 2020-04-12 14:39:12 +01:00
PropertyBasedMgr.hxx Replace boost::function by std::function 2020-04-22 14:04:21 +01:00
PropertyInterpolationMgr.cxx Ensure <simgear_config.h> is always included. 2017-03-28 09:36:53 +01:00
PropertyInterpolationMgr.hxx SGSubsystem classes: Subsystem and subsystem group API declaration standardisation. 2019-06-16 14:12:38 +02:00
PropertyInterpolator.cxx Ensure <simgear_config.h> is always included. 2017-03-28 09:36:53 +01:00
PropertyInterpolator.hxx Tweak interpolator and allow passing list of interpolation steps 2013-03-16 16:36:20 +01:00
propertyObject_test.cxx PropertyObject: Unit test for declaration followed by definition. 2018-12-04 12:38:14 +01:00
propertyObject.cxx Fix PropertyObject bug and interface improvements. 2013-02-07 01:25:55 +01:00
propertyObject.hxx PropertyObject: create() function support for SGPropertyNode_ptr. 2018-12-04 12:38:14 +01:00
props_io.cxx Add copyPropertiesIf helper 2020-05-03 12:21:36 +01:00
props_io.hxx Add copyPropertiesIf helper 2020-05-03 12:21:36 +01:00
props_test.cxx simgear/props/props.cxx: Avoid possible SEGV e.g. if listener removes itself. 2020-06-13 18:11:49 +01:00
props.cxx simgear/props/props.cxx: Avoid possible SEGV e.g. if listener removes itself. 2020-06-13 18:11:49 +01:00
props.hxx simgear/props/props.cxx: Avoid possible SEGV e.g. if listener removes itself. 2020-06-13 18:11:49 +01:00
propsfwd.hxx Extend propsfwd.hxx so it can be used in more places 2018-08-11 18:41:29 +02:00
tiedpropertylist.hxx Allow TiedPropertyList to fire valueChanged 2020-04-10 10:41:00 +01:00
vectorPropTemplates.hxx Move vector property templates to separate header file. 2012-05-05 00:07:07 +02:00