globjects
globjects copied to clipboard
Outdated documentation concerning memory model
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_ptrusually 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 newShaderif it's destructed / re-allocated on our side? Or is it magically done through the listener interface?- Entanglement is not clear.
Programhave a pointer on theShader, butShaderalso take a pointer on theProgramin theattachmethod. Who should delete the other ? - Exception safety... that's a huge question by itself
- Dependence on the GL context ? Is a
globject::XXXinstance working correctly if used in a static singleton (thus destructed aftermain()is done and the GL context has vanished ?