Opened 13 years ago

Closed 13 years ago

#3037 closed Bugs (fixed)

assert and later crash on app shutdown if BOOST_CLASS_EXPORT is used in headers

Reported by: Marvin.Sielenkemper@… Owned by: Robert Ramey
Milestone: Boost 1.40.0 Component: serialization
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

The extended_type_info is registered multiple times if a header bound BOOST_CLASS_EXPORT is included in multiple implementation files. Each of these registrations enters the same type info object into a (multi-)map.

On shutdown only the _first_ unregistration removes _one_ object from the map and clears its key member. Since there are still pointers pointing to this object in the map, later unregistrations fail due to the invalid key.

The problem can easily be fixed by either removing the "break;" in the unregister function (thus keeping the multiple equal pointers in the map) or adding "if (m_key) return;" in the register function (thereby collapsing the multiplicity to one).

I have created a test to trigger the problem, patch follows.

Attachments (3)

patch2-fix.txt (584 bytes ) - added by Marvin.Sielenkemper@… 13 years ago.
the collapsing fix
patch2-test.zip (1.1 KB ) - added by Marvin.Sielenkemper@… 13 years ago.
a new test to trigger the problem
test_exported2.7z (112.1 KB ) - added by Marvin.Sielenkemper@… 13 years ago.
compiled binary with debug information (msvc 8.0)

Download all attachments as: .zip

Change History (7)

by Marvin.Sielenkemper@…, 13 years ago

Attachment: patch2-fix.txt added

the collapsing fix

comment:1 by Robert Ramey, 13 years ago

Status: newassigned

by Marvin.Sielenkemper@…, 13 years ago

Attachment: patch2-test.zip added

a new test to trigger the problem

comment:2 by Robert Ramey, 13 years ago

Resolution: fixed
Status: assignedclosed

I have made changes to extended_type_info.cpp and void_cast.cpp in the trunk. I can't really test these very well. I would appreciate it if you could rebuild the library with these latest files and try again.

Robert Ramey

comment:3 by Marvin.Sielenkemper@…, 13 years ago

Milestone: Boost 1.40.0
Resolution: fixed
Status: closedreopened
Version: Boost 1.39.0Boost Development Trunk

Checked with trunk rev. 53717.

The test opens a dialog (Debug Assertion Failed! [Cancel] [Retry] [Ignore]) and fails with message

--- snip ---

No errors detected. Assertion failed: NULL != r, file ..\..\..\libs\serialization\src\extended_type_info.cpp, line 49

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. EXIT STATUS: 3

--- snip ---

I'll try to add the relevant compiled files as an attachment.

by Marvin.Sielenkemper@…, 13 years ago

Attachment: test_exported2.7z added

compiled binary with debug information (msvc 8.0)

comment:4 by Robert Ramey, 13 years ago

Resolution: fixed
Status: reopenedclosed

I've made changes to address this in the trunk. As I write this, only one test - test_no_rtti is manifesting this behavior. I', still looking at this. double check wiht the trunk version

Note: See TracTickets for help on using tickets.