X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglx%2Fapplegl_glx.c;h=a67416ec3f454bbd28f7f918165c17d487a6eef5;hb=df0de9320684be29d45121a06de2fa64328eadaf;hp=8766c88a136ac1ddab7af5c6bed8645a31dc4fca;hpb=c3b2230b71cb3a00a7f4c0987197d397bada650b;p=mesa.git diff --git a/src/glx/applegl_glx.c b/src/glx/applegl_glx.c index 8766c88a136..a67416ec3f4 100644 --- a/src/glx/applegl_glx.c +++ b/src/glx/applegl_glx.c @@ -69,6 +69,24 @@ applegl_bind_context(struct glx_context *gc, struct glx_context *old, static void applegl_unbind_context(struct glx_context *gc, struct glx_context *new) { + Display *dpy; + bool error; + + /* If we don't have a context, then we have nothing to unbind */ + if (!gc) + return; + + /* If we have a new context, keep this one around and remove it during bind. */ + if (new) + return; + + dpy = gc->psc->dpy; + + error = apple_glx_make_current_context(dpy, + (gc != &dummyContext) ? gc->driContext : NULL, + NULL, None); + + apple_glx_diagnostic("%s: error %s\n", __func__, error ? "YES" : "NO"); } static void @@ -116,12 +134,12 @@ applegl_create_context(struct glx_screen *psc, /* TODO: Integrate this with apple_glx_create_context and make * struct apple_glx_context inherit from struct glx_context. */ - gc = Xcalloc(1, sizeof (*gc)); + gc = calloc(1, sizeof(*gc)); if (gc == NULL) return NULL; if (!glx_context_init(gc, psc, config)) { - Xfree(gc); + free(gc); return NULL; } @@ -155,11 +173,10 @@ applegl_create_screen(int screen, struct glx_display * priv) { struct glx_screen *psc; - psc = Xmalloc(sizeof *psc); + psc = calloc(1, sizeof *psc); if (psc == NULL) return NULL; - memset(psc, 0, sizeof *psc); glx_screen_init(psc, screen, priv); psc->vtable = &applegl_screen_vtable;