winex11.drv: cleanup better in X11DRV_WineGL_InitOpenglInfo

Jesse Allen the3dfxdude at
Wed Sep 13 18:48:12 CDT 2006

I found an issue after the patch by Roderick that moved WGL extension
code to winex11. One is Star Wars Battlefront crashes immediately upon
starting. Second the d3d9 swapchain test crashes. I narrowed the
problem to a call of glXMakeCurrent in X11DRV_WineGL_InitOpenglInfo.
It doesn't crash there, but the call(s) will make it crash later.

Upon closer look of IWineD3DDeviceImpl_CreateAdditionalSwapChain near
where the swapchain test crashes, I found that the function also
queries for OpenGL information. It does so by saving whatever old
context and drawable is currently there first, doing its stuff and
then restoring the old context and drawable. Since
X11DRV_WineGL_InitOpenglInfo doesn't do that, I decided to make it do
it as well and found that it fixes the crash. So I believe the problem
is caused when the function overrides the current context.

This patch also attempts to clean up better on the error path too, by
unlocking, releasing visual, etc.

This patch has been tested by Andras on an Nvidia 6600 which he said
has the same problem too. It fixed HL2 and Max Payne for him.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: InitOpenglInfo.patch
Type: application/octet-stream
Size: 2018 bytes
Desc: not available
Url :

More information about the wine-patches mailing list