summaryrefslogtreecommitdiff
path: root/GL/glx
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-04-24 16:37:29 +1000
committerDave Airlie <airlied@redhat.com>2008-04-24 16:37:29 +1000
commitae982a27e4059fecd4048d245e6aa02f8dcc97d0 (patch)
tree344240ad30953ff9499c1ebd6df3117406766e31 /GL/glx
parentf377141912594f87144d6d7f7fdd279a101d8e6c (diff)
glx: test for valid read and draw privates before using them
this should fix a bug where f-spot exiting blows up the X server
Diffstat (limited to 'GL/glx')
-rw-r--r--GL/glx/glxutil.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/GL/glx/glxutil.c b/GL/glx/glxutil.c
index 11e9f898b..aa23a95fd 100644
--- a/GL/glx/glxutil.c
+++ b/GL/glx/glxutil.c
@@ -81,38 +81,40 @@ __glXDeassociateContext(__GLXcontext *glxc)
__GLXcontext *curr, *prev;
prev = NULL;
- for ( curr = glxc->drawPriv->drawGlxc
- ; curr != NULL
- ; prev = curr, curr = curr->nextDrawPriv ) {
- if (curr == glxc) {
- /* found context. Deassociate. */
- if (prev == NULL) {
- glxc->drawPriv->drawGlxc = curr->nextDrawPriv;
- } else {
- prev->nextDrawPriv = curr->nextDrawPriv;
+ if (glxc->drawPriv) {
+ for ( curr = glxc->drawPriv->drawGlxc; curr != NULL
+ ; prev = curr, curr = curr->nextDrawPriv ) {
+ if (curr == glxc) {
+ /* found context. Deassociate. */
+ if (prev == NULL) {
+ glxc->drawPriv->drawGlxc = curr->nextDrawPriv;
+ } else {
+ prev->nextDrawPriv = curr->nextDrawPriv;
+ }
+ curr->nextDrawPriv = NULL;
+ __glXUnrefDrawable(glxc->drawPriv);
+ break;
}
- curr->nextDrawPriv = NULL;
- __glXUnrefDrawable(glxc->drawPriv);
- break;
- }
+ }
}
-
prev = NULL;
- for ( curr = glxc->readPriv->readGlxc
- ; curr != NULL
- ; prev = curr, curr = curr->nextReadPriv ) {
- if (curr == glxc) {
- /* found context. Deassociate. */
- if (prev == NULL) {
- glxc->readPriv->readGlxc = curr->nextReadPriv;
- } else {
- prev->nextReadPriv = curr->nextReadPriv;
- }
- curr->nextReadPriv = NULL;
- __glXUnrefDrawable(glxc->readPriv);
- break;
- }
+ if (glxc->readPriv) {
+ for ( curr = glxc->readPriv->readGlxc
+ ; curr != NULL
+ ; prev = curr, curr = curr->nextReadPriv ) {
+ if (curr == glxc) {
+ /* found context. Deassociate. */
+ if (prev == NULL) {
+ glxc->readPriv->readGlxc = curr->nextReadPriv;
+ } else {
+ prev->nextReadPriv = curr->nextReadPriv;
+ }
+ curr->nextReadPriv = NULL;
+ __glXUnrefDrawable(glxc->readPriv);
+ break;
+ }
+ }
}
}