cginternals / cginternals/globjects
Example from the documentation on context initialization causes stack overflow
- Dominant language
- C++
- Stars
- 563
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Description
In the [Initialize Contexts](https://github.com/cginternals/globjects#initialize-contexts) section of the documentation it states you can sync OpenGL contexts using glbinding by doing:
```cpp
glbinding::Binding::addContextSwitchCallback([](glbinding::ContextHandle handle) {
setContext(handle);
});
```
And then do
```cpp
glbinding::Binding::useContext(handle);
```
to notify globjects and glbinding of the switch. But in [source/globjects/source/globjects.cpp#L177](https://github.com/cginternals/globjects/blob/master/source/globjects/source/globjects.cpp#L177) it looks like `globjects::setContext(glbinding::ContextHandle handle)` calls `glbinding::Binding::useContext(glbinding::ContextHandle handle)` internally, causing an infinite call chain and a stack overflow.
Just removing the section is probably enough to fix this, but it would be nice if it also explicitly states that the `init`, `setContext` and `setCurrentContext` globject functions also internally calls the glbinding equivalents.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.