Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3604: Access violation on diamond inheritance
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-12-02 08:03:33
#3604: Access violation on diamond inheritance
----------------------------------+-----------------------------------------
Reporter: kondo@⦠| Owner: ramey
Type: Support Requests | Status: reopened
Milestone: Boost 1.41.0 | Component: serialization
Version: Boost 1.40.0 | Severity: Not Applicable
Resolution: | Keywords:
----------------------------------+-----------------------------------------
Changes (by kondo@â¦):
* status: closed => reopened
* resolution: invalid =>
Comment:
I hesitated to reopen this ticket.
If the serialization library doesn't support the object serialization via
virtual base class, this idea might be a expansion proposal.
Should I create a new ticket as enhancement?
I wrote the patch(ticket3604.patch) seems to resolve this problem.
After applying this patch, Both EXPORT sequences in main.cpp work
correctly.
This patch is for trunk.
Please try it.
It is based on next idea.
= Background (My opinion) =
I think if the information in void_caster_registry is correct, we can
serialize the target class via virtual base class.
The void_caster_registry means a table that we can get it to call
void_caster_registry::get_mutable_instance().
It might be out of standard C++, but most of compiler works correctly.
= Strategy =
Avoid overwriting the virtual inheritance information in recursive
register process.
= Modification =
Add the new data member m_includes_virtual_base to class void_caster.
In void_caster::recursive_register() member function,
m_includes_virtual_base memorize virtual inheritance information from the
argument includes_virtual_base.
When the program creates the void_caster_shortcut object in
void_caster::recursive_register(), pass the 4th argument
'(*it)->m_includes_virtual_base || includes_virtual_base' instead of
includes_virtual_base.
As a result, the virtual inheritance information in void_caster_registry
is kept.
= Result report =
void_caster_registry information
== OK Case ==
EXPORT seruqnce:Target,Sub1
Before patching and after patching made same result.
MIVB means m_includes_virtual_base.
||No||MIVB||Derived||Base||
||0||FALSE||Target||Sub2||
||1||FALSE||Sub1||Mid1||
||2||FALSE||Sub1||Mid2||
||3||FALSE||Sub2||Mid1||
||4||FALSE||Target||Mid1||
||5||FALSE||Sub2||Mid2||
||6||FALSE||Target||Mid2||
||7||TRUE||Mid1||VBase||
||8||TRUE||Sub1||VBase||
||9||TRUE||Sub2||VBase||
== NG Case ==
EXPORT seruqnce:Sub1,Target
Before patching
||No||MIVB||Derived||Base||
||0||FALSE||Sub1||Mid1||
||1||FALSE||Sub1||Mid2||
||2||FALSE||Target||Sub2||
||3||TRUE||Mid1||VBase||
||4||TRUE||Sub1||VBase||
||5||TRUE||Mid2||VBase||
||6||TRUE||Sub1||VBase||
||7||FALSE||Sub2||Mid1||
||8||FALSE||Sub2||VBase||
||9||FALSE||Target||VBase||
No.8 and 9 seem to incorrect.Their MIVB should be true.
Afret patching
||No||MIVB||Derived||Base||
||0||FALSE||Sub1||Mid1||
||1||FALSE||Sub1||Mid2||
||2||FALSE||Target||Sub2||
||3||TRUE||Mid1||VBase||
||4||TRUE||Sub1||VBase||
||5||TRUE||Mid2||VBase||
||6||TRUE||Sub1||VBase||
||7||FALSE||Sub2||Mid1||
||8||TRUE||Sub2||VBase||
||9||TRUE||Target||VBase||
All information seems to be correct!
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3604#comment:8> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC