https://bugs.winehq.org/show_bug.cgi?id=43969
Bug ID: 43969 Summary: openGL SwapBuffers with NULL context Product: Wine Version: 2.19 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winex11.drv Assignee: wine-bugs@winehq.org Reporter: jp-dev@inbox.ru Distribution: ---
A fragment of openGL code works under Windows and crashes under wine staging 2.19 at glxdrv_wglSwapBuffers. This code can be found under the VSTGUI project (see https://git.io/vFCwl).
The problem in wine is triggered because the library makes a null context current before the invocation of swapBuffers. As strange as it may be, Windows is able to render in this condition. wglMakeCurrent (deviceContext, 0); SwapBuffers (deviceContext); When I pass a context instead of 0, wine works as well.
This reveals a pair of problems. First, there is a null pointer dereference in wgl_SwapBuffers. ctx->hdc is an invalid access because of the null context (I have added the `&& ctx` check). if (escape.gl_drawable && ctx) ExtEscape( ctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
This change allows the program to run without crash, but the result is no rendering. My test configuration on Windows was 8.1 with the vmware GL passthrough driver.
https://bugs.winehq.org/show_bug.cgi?id=43969
JP Cimalando jp-dev@inbox.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jp-dev@inbox.ru
https://bugs.winehq.org/show_bug.cgi?id=43969
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de
--- Comment #1 from Fabian Maurer dark.shadow4@web.de --- Is there a binary to test with?
Btw, you don't need to add yourself into the CC list when you reported the bug, you already get mails.
https://bugs.winehq.org/show_bug.cgi?id=43969
--- Comment #2 from JP Cimalando jp-dev@inbox.ru --- There is a binary, I have just compiled one however it's a Vst plugin, not the easiest thing to debug. But it can reproduce this bug, which took me some tedious time to trace. I have tried to reproduce the bug in a small program, but couldn't, so the particular context must be important. I have made a debug version which has two dlls: a working one and a crashing one with null context. I load this in dssi-vst on Linux, Hermann Seib's vsthost on Windows.
https://bugs.winehq.org/show_bug.cgi?id=43969
--- Comment #3 from JP Cimalando jp-dev@inbox.ru --- Created attachment 59623 --> https://bugs.winehq.org/attachment.cgi?id=59623 binaries for testing
https://bugs.winehq.org/show_bug.cgi?id=43969
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #4 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-4.9?
https://bugs.winehq.org/show_bug.cgi?id=43969
--- Comment #5 from JP Cimalando jp-dev@inbox.ru --- Tried in both wine 9.4 and 9.4 staging, it's not resolved. The original dll still crashes, and the workaround dll still works.
https://bugs.winehq.org/show_bug.cgi?id=43969
--- Comment #6 from JP Cimalando jp-dev@inbox.ru --- Created attachment 64671 --> https://bugs.winehq.org/attachment.cgi?id=64671 Backtrace from dssi-vst using Wine 4.9
https://bugs.winehq.org/show_bug.cgi?id=43969
--- Comment #7 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-6.5?