Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context state overlap when initializing/releasing multiple contexts #343

Open
cfillion opened this issue Mar 10, 2023 · 0 comments
Open

Comments

@cfillion
Copy link

cfillion commented Mar 10, 2023

Initializing a context after another one has been released may cause two contexts to share the same state, leading to crashes after one of the remaining contexts is also released. I've observed the following sequence of events:

initialize(0x1)
initialize(0x2)
  s_bindings = {0x1 => 0, 0x2 => 1}
  s_maxPos   = 1

releaseContext(0x1)
  s_bindings = {0x2 => 1}

initialize(0x3)
  pos        = s_bindings.size()    --> 1, expected 2 (s_maxPos() + 1) or 0 (reusing the previously released slot)
  s_bindings = {0x2 => 1, 0x3 => 1} --> BUG: both contexts share the same state!

releaseContext(0x2)
  s_maxPos   = 0                    --> BUG: context 0x3's state is released!
  s_bindings = {0x3 => 1}

later when using context 0x3:
  assertion failed: AbstractFunction::maxPos() >= pos

(glbinding v3.1.0 from vcpkg - relevant code appears unchanged in v3.3)

@cfillion cfillion changed the title Context state overlap when initialilizing/releasing multiple contexts Context state overlap when initializing/releasing multiple contexts Mar 10, 2023
cfillion added a commit to cfillion/reaimgui that referenced this issue Mar 11, 2023
glbindings has a fatal bug when initializing and releasing multiple contexts (cginternals/glbinding#343)
+ it adds an excessive 1.4MB to the size of release builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant