Opened 13 years ago
Closed 13 years ago
#3957 closed Bugs (fixed)
De-serialization of shared_ptrs derived from enable_shared_from_this fail
Reported by: | Owned by: | Robert Ramey | |
---|---|---|---|
Milestone: | Boost 1.43.0 | Component: | serialization |
Version: | Boost 1.42.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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<void> is created inside file shared_ptr_helper.cpp, instead of a shared_ptr<T>, 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.
A patch file is attached and also a test program, modified from one originally written by Alexander Gutenev.
Thanks,
Bud Clarke
Attachments (4)
Change History (7)
by , 13 years ago
Attachment: | patchfile.patch added |
---|
comment:1 by , 13 years ago
I'm having problems with test_weak_ptr_serialization.tgz - could you send a *.zip file version?
Robert Ramey
by , 13 years ago
Attachment: | weak_ptr_serialization.zip added |
---|
Zip file containing test program and VC 9.0 project files
comment:2 by , 13 years ago
Status: | new → assigned |
---|
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.
Thanks for this.
Robert Ramey
comment:3 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
patch incorporated in trunk and release
Patch file