cginternals / cginternals/globjects
Outdated documentation concerning memory model
- Dominant language
- C++
- Stars
- 563
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Description
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:
1. 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) ?
2. `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?
3. 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 ?
4. Exception safety... that's a huge question by itself
5. 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 ?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.