[Serialization - 1.35] Crash while serializing
Hi,
I've following class hierarchy:
FilterCondition <---+--- CompositeCondition
|
+--- ConcreteCondition
FilterCondition is ABC. FilterCondition has certain data members which I
need to serialize.
I already have another class "Table" for which serialization works
perfectly. Now, I've added a pointer of type "FilterCondition" as a member
to "Table". Say, the member name is "filterCond_".
Now, as soon as I add following line in Table::serialize(), I get a crash :
ar & filterCond_;
This happens even though I make body of FilterCondition::serialize(),
CompositeCondition::serialize() and
ConcreteCondition::serialize() empty.
In Table::serialize(), I've verified that filterCond_ is a valid pointer.
I've declared FilterCondition as abstract through BOOST_CLASS_ABSTRACT macro
as well.
Following is top of stack from gdb:
------------------------------------------------------------------------------------------------
(gdb) where
#0 0x0000000000fcfee6 in
boost::serialization::detail::extended_type_info_typeid_0::less_than ()
#1 0x0000000000fcf703 in
boost::serialization::extended_type_info::operator< ()
#2 0x0000000000fcf78b in boost::serialization::extended_type_info::find ()
#3 0x0000000000fcffea in
boost::serialization::detail::extended_type_info_typeid_0::get_derived_extended_type_info
()
#4 0x000000000136ca0c in
boost::serialization::detail::extended_type_info_typeid_1<FilterCondition
const>::get_derived_extended_type_info (t=@0x19c6e390) at
/remote/arch-tools/boost/qsc-b/1_35_0/include/boost/serialization/extended_type_info_typeid.hpp:92
#5 0x000000000136ca5b in
boost::archive::detail::save_pointer_type
Try adding BOOST_CLASS_EXPORT(ConcreteCondition) Robert Ramey Soumen wrote:
Hi,
I've following class hierarchy:
FilterCondition <---+--- CompositeCondition | +--- ConcreteCondition
FilterCondition is ABC. FilterCondition has certain data members which I need to serialize.
I already have another class "Table" for which serialization works perfectly. Now, I've added a pointer of type "FilterCondition" as a member to "Table". Say, the member name is "filterCond_".
Now, as soon as I add following line in Table::serialize(), I get a crash :
ar & filterCond_;
This happens even though I make body of FilterCondition::serialize(), CompositeCondition::serialize() and ConcreteCondition::serialize() empty.
In Table::serialize(), I've verified that filterCond_ is a valid pointer. I've declared FilterCondition as abstract through BOOST_CLASS_ABSTRACT macro as well.
Hi Robert,
Thanks for your suggestion - I's actually doing all the export in different
header file (I mentioned previously in another posting) containing all the
export to reduce compile time. But moving the export in ConcreteCondition.h
and CompositeCondition.h causes the crash to turn into a "unregistered"
exception. Now, I guess I can work on it. If it doesn't work, I'll get back
to the same posting.
Regards,
~ Soumen
On Tue, Sep 22, 2009 at 10:36 PM, Robert Ramey
Try adding
BOOST_CLASS_EXPORT(ConcreteCondition)
Robert Ramey
Soumen wrote:
Hi,
I've following class hierarchy:
FilterCondition <---+--- CompositeCondition | +--- ConcreteCondition
FilterCondition is ABC. FilterCondition has certain data members which I need to serialize.
I already have another class "Table" for which serialization works perfectly. Now, I've added a pointer of type "FilterCondition" as a member to "Table". Say, the member name is "filterCond_".
Now, as soon as I add following line in Table::serialize(), I get a crash :
ar & filterCond_;
This happens even though I make body of FilterCondition::serialize(), CompositeCondition::serialize() and ConcreteCondition::serialize() empty.
In Table::serialize(), I've verified that filterCond_ is a valid pointer. I've declared FilterCondition as abstract through BOOST_CLASS_ABSTRACT macro as well.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi, I'm revisiting the item - now I think I've fair idea of the problem but not the solution. My class structure is as described before:
FilterCondition <---+--- CompositeCondition | +--- ConcreteCondition
CompositeCondition is "composed of" FilterCondition. Class "Table" is serializable and is "composed of" FilterCondition. FilterCondition is ABC. Class FilterCondition is defined in FilterCondition.h Class CompositeCondition is defined in CompositeCondition.h Class ConcreteCondition is defined in ConcreteCondition.h Class Table is defined in Table.h Class Table1, Table2, Table3, ... are derived from class Table and are serializable and all are defined in Table.h All Table1, Table2, Table3, ... are exported in Export.h - this is done to minimize compile time overhead as Table.h is included in many .cpp files. Now, if I do export of ConcreteCondition and CompositeCondition in Export.h, it causes "unregistered class" exception as the line in Table.h which does serialization of FilterCondition is unaware of dynamic type of FilterCondition member (as Export.h is not included in Table.h - otherwise I may face the compilation run time problem again). And if I export ConcreteCondition in ConcreteCondition.h and same for CompositeCondition, I get compilation error due to conflict in expanded export instantiation. Can someone suggest me how to solve this problem? Regards, ~ Soumen -- View this message in context: http://old.nabble.com/-Serialization---1.35--Crash-while-serializing-tp25530... Sent from the Boost - Users mailing list archive at Nabble.com.
participants (3)
-
Robert Ramey
-
Soumen
-
Soumen Ghosh