Error in <TExMap::Add>: key 2 is not unique

From: Egon Pavlica <Egon.Pavlica_at_p-ng.si>
Date: Fri, 18 Mar 2005 12:01:30 +0100 (CET)


Hello rooters!

Does anybody know this problem (i think is a problem). I have a class, child of a TObject, which has own Streamer. In this streamer i stream two members - classes, also children of TObject. These two members are pointers of type ClassA but actually they are any of classes ClassB or ClassC, that are children of ClassA, i use this procedure to stream:

R__b.WriteClass(classA1->Class());
R__b.WriteObjectAny(classA1,classA1->Class());
R__b.WriteClass(classA2->Class());
R__b.WriteObjectAny(classA2,classA2->Class());

and

TClass* cl=R__b.ReadClass();
classA1=(classA1*)R__b.ReadObjectAny(cl);
//delete cl;

TClass* cl2=R__b.ReadClass();
classA2=(classA2*)R__b.ReadObjectAny(cl2);
//delete cl2;

this reading gives the error:
Error in <TExMap::Add>: key 2 is not unique

that really confuse me. i cant afford any memory leak. so i am wondering why cant i delete classes cl and cl2. Also, it there any other posibility to stream classes classB and classC, which addresses are stored in classA1 and classA2.

thanks,
Egon Pavlica Received on Fri Mar 18 2005 - 12:01:39 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:06 MET