Rémi Bernon (@rbernon) commented about dlls/winewayland.drv/opengl.c:
+ ctx->draw = draw_gl; + ctx->read = read_gl; + NtCurrentTeb()->glContext = ctx; + } + else + { + release[0] = draw_gl; + release[1] = read_gl; + } + + pthread_mutex_unlock(&gl_object_mutex); + + /* Release the drawables outside the gl_object_mutex lock, since the release + * process may acquire the wayland_surface lock and lead to a deadlock. */ + for (i = 0; i < ARRAY_SIZE(release); ++i) + if (release[i]) wayland_gl_drawable_release(release[i]); Would be just as simple with two ifs instead of a loop, do you expect to have a bigger array? What about even naming them old_draw / old_read?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/5177#note_63100