winex11.drv: Make wglShareLists() cope with previously selected destination context (try 3)

Roderick Colenbrander thunderbird2k at gmx.net
Thu Sep 18 02:27:21 CDT 2008


Hi,

First of all note that glXDestroyContext only destroys a context after no of the other threads is using it (it is in the specs of glXDestroyContext). Second there are some more issues in wglShareLists which shouldn't get fixed in your patch but which I plan to fix at a later stage which you should take into account. Some BAD class of apps calls wglShareLists before making the source context current (so it isn't backed by a GLX context) while it has made the destination one current. In such case we need to perform a swap as right now such programs crash. MSDN clearly mentions that the hglrc2 parameter shouldn't contain any existing display lists, so this situation isn't allowed. This would mean wglShareLists(dest, source) is invalid and second that when perform a legal wglShareLists(source, dest) that dest can't have been current in any thread.

Since wglShareLists is a tricky function which might require very ugly hacks I want to keep it as clean as possible. This means that you should write a small wine test case for the behavior of wglShareLists in the situation affected by your patch.

Roderick

> The current wglShareLists() will fail if the destination context has ever
> been made current. This causes a crash in Homeworld 2, unless pbuffers are
> disabled. This patch fixes the crash by deleting and recreating the
> underlying OpenGL context, unless it is still current in some thread.
> 
> Improved patch by: Moving the deletion of the old context into the
> wine_tsx11_lock where it belongs; tracking whether a WGL context is current in
> some thread so we don't deselect it out from under the app; adding an
> explanatory comment; a more professional change entry ;)

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger



More information about the wine-devel mailing list