Boost C++ Libraries: Ticket #3957: De-serialization of shared_ptrs derived from enable_shared_from_this fail https://svn.boost.org/trac10/ticket/3957 <p> De-serialization of shared_ptrs derived from enable_shared_from_this fails to initialize the base enable_shared_from_this objects, which causes a program crash when shared_from_this() is called. The root cause seems to be that a shared_pointer&lt;void&gt; is created inside file shared_ptr_helper.cpp, instead of a shared_ptr&lt;T&gt;, with T being the original class. This causes the non-enable_shared_from_this constructor to be called. I worked around this by moving the initial construction of the shared_ptr to file shared_ptr_helper.hpp. </p> <p> A patch file is attached and also a test program, modified from one originally written by Alexander Gutenev. </p> <p> Thanks, </p> <p> Bud Clarke </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3957 Trac 1.4.3 Carus V. (Bud) Clarke <carus.v.clarke@…> Tue, 23 Feb 2010 19:59:24 GMT attachment set https://svn.boost.org/trac10/ticket/3957 https://svn.boost.org/trac10/ticket/3957 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">patchfile.patch</span> </li> </ul> <p> Patch file </p> Ticket Carus V. (Bud) Clarke <carus.v.clarke@…> Tue, 23 Feb 2010 19:59:55 GMT attachment set https://svn.boost.org/trac10/ticket/3957 https://svn.boost.org/trac10/ticket/3957 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test_weak_ptr_serialization.tgz</span> </li> </ul> <p> Test program </p> Ticket Carus V. (Bud) Clarke <carus.v.clarke@…> Tue, 23 Feb 2010 21:43:20 GMT attachment set https://svn.boost.org/trac10/ticket/3957 https://svn.boost.org/trac10/ticket/3957 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">patchfile-2.patch</span> </li> </ul> <p> Corrected patch file </p> Ticket Robert Ramey Fri, 26 Feb 2010 07:29:29 GMT <link>https://svn.boost.org/trac10/ticket/3957#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3957#comment:1</guid> <description> <p> I'm having problems with test_weak_ptr_serialization.tgz - could you send a *.zip file version? </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>Carus V. (Bud) Clarke <carus.v.clarke@…></author> <pubDate>Tue, 02 Mar 2010 16:54:04 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/3957 https://svn.boost.org/trac10/ticket/3957 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">weak_ptr_serialization.zip</span> </li> </ul> <p> Zip file containing test program and VC 9.0 project files </p> Ticket Robert Ramey Thu, 04 Mar 2010 08:06:59 GMT status changed https://svn.boost.org/trac10/ticket/3957#comment:2 https://svn.boost.org/trac10/ticket/3957#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> I've run you example and found it to fail. Then I included your patches and the example ran. I confess, I really didn't analyze your code carefully. I just assumed that anyone who goes into that area knows what he's doing. Could I ask you one more favor? Could you tweak the test so that I can add it to our test set? That is, it should return success if it passes. Also it would be nice if it did some BOOST_TEST_? macros to document what the expected results are. Look at the other tests to see how this is done. </p> <p> Thanks for this. </p> <p> Robert Ramey </p> Ticket Robert Ramey Mon, 15 Mar 2010 22:00:35 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3957#comment:3 https://svn.boost.org/trac10/ticket/3957#comment:3 <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> patch incorporated in trunk and release </p> Ticket