Boost C++ Libraries: Ticket #1007: boost::signals::trackable::operator= bug https://svn.boost.org/trac10/ticket/1007 <p> Boost: 1.34.0 Compiler: MSVC 8.0 (without SP1). </p> <p> Here is, minimal example. </p> <p> struct Conn : public boost::signals::trackable { </p> <blockquote> <p> void operator()(){} </p> </blockquote> <p> }; </p> <p> void f() { </p> <blockquote> <p> boost::signal&lt;void ()&gt; sig; Conn c; sig.connect( c ); </p> </blockquote> <blockquote> <p> c = Conn(); <em> crash inside.. </em></p> </blockquote> <p> } </p> <p> The reason is simple. During clear() method of std::list, there are signals::connection destructor calls are happening, which, in turn, calling erase method of the same std::list, and as a result we're getting _DEBUG_ERROR("list erase iterator outside range"); </p> <p> I guess, the bug is with "dying" variable: in destructor, it was set to true, and then signals::connection destructors are not trying to remove themself from the std::list. But in boost::signals::trackable::operator=() there is no dying flag marking. </p> <p> Evgeny. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1007 Trac 1.4.3 Douglas Gregor Mon, 11 Jun 2007 20:12:39 GMT status changed; owner set https://svn.boost.org/trac10/ticket/1007#comment:1 https://svn.boost.org/trac10/ticket/1007#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Douglas Gregor</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Douglas Gregor Mon, 11 Jun 2007 20:16:55 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1007#comment:2 https://svn.boost.org/trac10/ticket/1007#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> This is the fix, which is committed to the Boost trunk for future releases. It is probably too late for 1.34.1: </p> <p> Index: trackable.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/signals/trackable.hpp,v retrieving revision 1.19 diff -u -<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">r1</a>.19 trackable.hpp --- trackable.hpp 26 Dec 2004 22:05:19 -0000 1.19 +++ trackable.hpp 11 Jun 2007 20:16:13 -0000 @@ -43,7 +43,9 @@ </p> <blockquote> <p> trackable&amp; operator=(const trackable&amp;) { </p> </blockquote> <p> + dying = true; </p> <blockquote> <p> connected_signals.clear(); </p> </blockquote> <p> + dying = false; </p> <blockquote> <p> return *this; </p> </blockquote> <blockquote> <p> } </p> </blockquote> <p> </p> Ticket