Destroy object causes a runtime failure
ksuryagiridhar opened this issue · 0 comments
ksuryagiridhar commented
Hi,
I am trying to use ponder for reflection. I create instances of a class declared to ponder and then store the pointer to the objects in a generic datamodel.
The code looks something like below:
bool object_factory()
{
const ponder::Class& metaClass = ponder::ClassByType<Type>();
ponder::UserObject object = ponder::runtime::create(metaClass);
void* ptr = object.pointer();
if(add_to_datamodel(ptr) == FAILURE)
{
ponder::runtime::destroy(object);
return FAILURE;
}
return SUCCESS;
}
The code builds fine and I see below runtime error when I execute unit test where the add_to_datamodel failed. The object destroy is leading to an invalid pointer.
free(): invalid pointer
Aborted
I run google tests on ubuntu 20.04 version.
I tried to maintain object creation and destruction similar to the library examples and it doesn't work, could you help me with the issue?