Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroy object causes a runtime failure #125

Open
ksuryagiridhar opened this issue Jul 20, 2021 · 0 comments
Open

Destroy object causes a runtime failure #125

ksuryagiridhar opened this issue Jul 20, 2021 · 0 comments

Comments

@ksuryagiridhar
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant