cginternals / globjects

C++ library strictly wrapping OpenGL objects.
https://globjects.org
MIT License
538 stars 59 forks source link

potential heap corruption by destroy() in class HeapOnly? #356

Closed freehour closed 6 years ago

freehour commented 7 years ago

Maybe I missed something, but isn't the client application of the library supposed to call delete this;, since it also creates the object with new ...? But destroy() { delete this;} is implemented in HeapOnly.cpp and compiled into the shared library, thus trying to delete the object from a potentially different heap. I think this is no issue if both client and library are linked with the same run-time library, but this might not always be the case. Moving the implementation to the header should solve this.

scheibel commented 6 years ago

This is obsolete with the current memory model. We switched to clear client-managed dynamic memory by use of unique and shared pointers. Before, this was likely a problem if you don't use the reference counting throughout your code.