1d978429f5
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. |
||
---|---|---|
3rdparty | ||
CMakeModules | ||
simgear | ||
.gitignore | ||
AUTHORS | ||
ChangeLog | ||
CMakeLists.txt | ||
COPYING | ||
Doxyfile | ||
DoxygenMain.cxx | ||
INSTALL | ||
NEWS | ||
README | ||
README.cmake | ||
README.OSG | ||
README.sound | ||
README.zlib | ||
SimGearConfig.cmake.in | ||
Thanks | ||
version |
SimGear - Simulator Construction Tools ====================================== http://www.flightgear.org SimGear is a set of open-source libraries designed to be used as building blocks for quickly assembling 3d simulations, games, and visualization applications. SimGear is developed by the FlightGear project and also provides the base for the FlightGear Flight Simulator. Source code for SimGear is released under the GNU Library General Public License (LGPL) - see COPYING for license details. See INSTALL file for help on building SimGear.