mercredi 30 septembre 2015

C++ unique_ptr destructor saying object has never been allocated

I have a main process that owns a Model object. The purpose of this is to share a Model between various objects that performs tasks and modifies the same Model.

Right now, I create a unique_ptr to this object and pass a reference to that unique_ptr to other objects to perform certain tasks.

The tasks all complete correctly, but something weird happens when it tries to call the destructor on the unique_ptr. It shows:

RAW: memory allocation bug: object at 0xd0ebdfb2b8 has never been allocated

Question:

  1. Why is this error happening?
  2. Is unique_ptr the right way to tackle this problem?

Thanks

Aucun commentaire:

Enregistrer un commentaire