Hi Cédric, hi Robert, Forgot to mention that's the same for removeEventCallback() and removeCullCallback(). BTW, add*Callback() may also need to check if the 'nc' is not NULL (since we don't expect "add" to add a NULL callback anywhere). So, attached is the modified file, against rev. 9615 of the trunk, with both "add" and "remove" modified.
Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ Le Mon, 02 Feb 2009 07:29:34 +0100, Sukender <[email protected]> a écrit: > Yes, Cédric, that sounds logical to me (This was a tiny submission of mine). > However, I'd add some braces for the "if" statement ;) > > Sukender > PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ > > > Le Sun, 01 Feb 2009 22:32:29 +0100, Cedric Pinson <[email protected]> a > écrit: > >> Hi Robert, >> >> I just get a crash with the trunk with the following code: >> >> node->removeUpdateCallback(MyNodeCallback) >> >> if there is no NodeCallback already set it crashes, if the >> MyNodeCallback is 0 it crashes too. >> So i suggest to add this code: >> >> inline void removeUpdateCallback(NodeCallback* nc) { >> if (_updateCallback.valid() && nc != 0) >> if (_updateCallback == nc) >> setUpdateCallback(nc->getNestedCallback()); // replace the >> callback by the nested one >> else _updateCallback->removeNestedCallback(nc); >> } >> >> instead of >> >> inline void removeUpdateCallback(NodeCallback* nc) { >> if (_updateCallback == nc) >> setUpdateCallback(nc->getNestedCallback()); // replace the >> callback by the nested one >> else _updateCallback->removeNestedCallback(nc); >> } >> >> >> Does it make sense for you ? >> >> Cheers, >> Cedric > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Node
Description: Binary data
_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
