diff options
-rw-r--r-- | glx/glxcmds.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c index 19d8674a1..aedbc02b0 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -148,8 +148,10 @@ void __glXContextDestroy(__GLXcontext *context) { if (!context->isDirect) { - __glXUnrefDrawable(context->drawPriv); - __glXUnrefDrawable(context->readPriv); + if (context->drawPriv) + __glXUnrefDrawable(context->drawPriv); + if (context->readPriv) + __glXUnrefDrawable(context->readPriv); } __glXFlushContextCache(); } @@ -621,8 +623,10 @@ DoMakeCurrent(__GLXclientState *cl, } __glXFlushContextCache(); if (!prevglxc->isDirect) { - __glXUnrefDrawable(prevglxc->drawPriv); - __glXUnrefDrawable(prevglxc->readPriv); + if (prevglxc->drawPriv) + __glXUnrefDrawable(prevglxc->drawPriv); + if (prevglxc->readPriv) + __glXUnrefDrawable(prevglxc->readPriv); } } |