On the main page, the documentation talk about using ref_ptr for memory management, but none of the code does that. It's not clear what is the current memory model expectation from globjects now it's using unique_ptr, so I guess a update of the documentation is required.
It should answer these questions:
When the globject interface use a plain pointer, who is managing the pointer lifetime (is it owned by globjects or should we keep track of them ourselves) ?
unique_ptr usually means that we (users) need to deal with the pointer's life (and unique_ptr is doing exactly this for us), yet some of the globjects API is using plain pointers. Do we need to reassign the pointer if we update the owned object ? For example, in Program::attach(Shader * shader), do we need to detach and attach a new Shader if it's destructed / re-allocated on our side? Or is it magically done through the listener interface?
Entanglement is not clear. Program have a pointer on the Shader, but Shader also take a pointer on the Program in the attach method. Who should delete the other ?
Exception safety... that's a huge question by itself
Dependence on the GL context ? Is a globject::XXX instance working correctly if used in a static singleton (thus destructed after main() is done and the GL context has vanished ?
On the main page, the documentation talk about using
ref_ptr
for memory management, but none of the code does that. It's not clear what is the current memory model expectation from globjects now it's usingunique_ptr
, so I guess a update of the documentation is required.It should answer these questions:
unique_ptr
usually means that we (users) need to deal with the pointer's life (and unique_ptr is doing exactly this for us), yet some of the globjects API is using plain pointers. Do we need to reassign the pointer if we update the owned object ? For example, inProgram::attach(Shader * shader)
, do we need to detach and attach a newShader
if it's destructed / re-allocated on our side? Or is it magically done through the listener interface?Program
have a pointer on theShader
, butShader
also take a pointer on theProgram
in theattach
method. Who should delete the other ?globject::XXX
instance working correctly if used in a static singleton (thus destructed aftermain()
is done and the GL context has vanished ?