aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glx/glxext.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/glx/glxext.c')
-rw-r--r--xorg-server/glx/glxext.c46
1 files changed, 35 insertions, 11 deletions
diff --git a/xorg-server/glx/glxext.c b/xorg-server/glx/glxext.c
index 2c3f5edf0..3a7de28fb 100644
--- a/xorg-server/glx/glxext.c
+++ b/xorg-server/glx/glxext.c
@@ -95,16 +95,15 @@ __glXResetLargeCommandStatus(__GLXclientState * cl)
}
/*
-** This procedure is called when the client who created the context goes
-** away OR when glXDestroyContext is called. In either case, all we do is
-** flag that the ID is no longer valid, and (maybe) free the context.
-** use.
-*/
+ * This procedure is called when the client who created the context goes away
+ * OR when glXDestroyContext is called. In either case, all we do is flag that
+ * the ID is no longer valid, and (maybe) free the context.
+ */
static int
ContextGone(__GLXcontext * cx, XID id)
{
cx->idExists = GL_FALSE;
- if (!cx->isCurrent) {
+ if (!cx->currentClient) {
__glXFreeContext(cx);
}
@@ -138,9 +137,10 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid)
for (c = glxAllContexts; c; c = next) {
next = c->next;
- if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
+ if (c->currentClient &&
+ (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
+ /* just force a re-bind the next time through */
(*c->loseCurrent) (c);
- c->isCurrent = GL_FALSE;
if (c == __glXLastContext)
__glXFlushContextCache();
}
@@ -196,17 +196,17 @@ __glXRemoveFromContextList(__GLXcontext * cx)
GLboolean
__glXFreeContext(__GLXcontext * cx)
{
- if (cx->idExists || cx->isCurrent)
+ if (cx->idExists || cx->currentClient)
return GL_FALSE;
+ __glXRemoveFromContextList(cx);
+
free(cx->feedbackBuf);
free(cx->selectBuf);
if (cx == __glXLastContext) {
__glXFlushContextCache();
}
- __glXRemoveFromContextList(cx);
-
/* We can get here through both regular dispatching from
* __glXDispatch() or as a callback from the resource manager. In
* the latter case we need to lift the DRI lock manually. */
@@ -283,6 +283,7 @@ glxClientCallback(CallbackListPtr *list, pointer closure, pointer data)
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
ClientPtr pClient = clientinfo->client;
__GLXclientState *cl = glxGetClient(pClient);
+ __GLXcontext *c, *next;
switch (pClient->clientState) {
case ClientStateRunning:
@@ -290,6 +291,16 @@ glxClientCallback(CallbackListPtr *list, pointer closure, pointer data)
break;
case ClientStateGone:
+ /* detach from all current contexts */
+ for (c = glxAllContexts; c; c = next) {
+ next = c->next;
+ if (c->currentClient == pClient) {
+ c->loseCurrent(c);
+ c->currentClient = NULL;
+ __glXFreeContext(c);
+ }
+ }
+
free(cl->returnBuf);
free(cl->largeCmdBuf);
free(cl->GLClientextensions);
@@ -530,6 +541,19 @@ __glXleaveServer(GLboolean rendering)
glxServerLeaveCount++;
}
+static void (*(*_get_proc_address)(const char *))(void);
+
+void
+__glXsetGetProcAddress(void (*(*get_proc_address) (const char *))(void))
+{
+ _get_proc_address = get_proc_address;
+}
+
+void *__glGetProcAddress(const char *proc)
+{
+ return _get_proc_address(proc);
+}
+
/*
** Top level dispatcher; all commands are executed from here down.
*/