Double Delete On Deserialization
Posted: Wed Jan 10, 2018 4:48 am
I have an object / project structure that is serialized to a binary file. Sub objects reference the parent object.
After performing the call below, the private data of item and the child related objects all point the same physical address but somehow share 2 separate instance of QSharedPointer. The outer QSharedPointer item has it's own instance and all the children are referencing the other instance.
Outer instance strong ref count = 1;
Children instances strong ref count = 75;
As a result when I go to clean up this object I'm stuck with a double delete segfault...
Help?
After performing the call below, the private data of item and the child related objects all point the same physical address but somehow share 2 separate instance of QSharedPointer. The outer QSharedPointer item has it's own instance and all the children are referencing the other instance.
Outer instance strong ref count = 1;
Children instances strong ref count = 75;
As a result when I go to clean up this object I'm stuck with a double delete segfault...
Help?
- Code: Select all
QSharedPointer<T> item;
if (qx::serialization::binary::from_file(item, fileInfo.absoluteFilePath()))