Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Destroy object causes a runtime failure #125

Description

@ksuryagiridhar

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions