|
|
ba9193e |
From ae982a27e4059fecd4048d245e6aa02f8dcc97d0 Mon Sep 17 00:00:00 2001
|
|
|
ba9193e |
From: Dave Airlie <airlied@redhat.com>
|
|
|
ba9193e |
Date: Thu, 24 Apr 2008 16:37:29 +1000
|
|
|
ba9193e |
Subject: [PATCH] glx: test for valid read and draw privates before using them
|
|
|
ba9193e |
|
|
|
ba9193e |
this should fix a bug where f-spot exiting blows up the X server
|
|
|
ba9193e |
---
|
|
|
ba9193e |
GL/glx/glxutil.c | 58 +++++++++++++++++++++++++++--------------------------
|
|
|
ba9193e |
1 files changed, 30 insertions(+), 28 deletions(-)
|
|
|
ba9193e |
|
|
|
ba9193e |
diff --git a/GL/glx/glxutil.c b/GL/glx/glxutil.c
|
|
|
ba9193e |
index 11e9f89..aa23a95 100644
|
|
|
ba9193e |
--- a/GL/glx/glxutil.c
|
|
|
ba9193e |
+++ b/GL/glx/glxutil.c
|
|
|
ba9193e |
@@ -81,38 +81,40 @@ __glXDeassociateContext(__GLXcontext *glxc)
|
|
|
ba9193e |
__GLXcontext *curr, *prev;
|
|
|
ba9193e |
|
|
|
ba9193e |
prev = NULL;
|
|
|
ba9193e |
- for ( curr = glxc->drawPriv->drawGlxc
|
|
|
ba9193e |
- ; curr != NULL
|
|
|
ba9193e |
- ; prev = curr, curr = curr->nextDrawPriv ) {
|
|
|
ba9193e |
- if (curr == glxc) {
|
|
|
ba9193e |
- /* found context. Deassociate. */
|
|
|
ba9193e |
- if (prev == NULL) {
|
|
|
ba9193e |
- glxc->drawPriv->drawGlxc = curr->nextDrawPriv;
|
|
|
ba9193e |
- } else {
|
|
|
ba9193e |
- prev->nextDrawPriv = curr->nextDrawPriv;
|
|
|
ba9193e |
+ if (glxc->drawPriv) {
|
|
|
ba9193e |
+ for ( curr = glxc->drawPriv->drawGlxc; curr != NULL
|
|
|
ba9193e |
+ ; prev = curr, curr = curr->nextDrawPriv ) {
|
|
|
ba9193e |
+ if (curr == glxc) {
|
|
|
ba9193e |
+ /* found context. Deassociate. */
|
|
|
ba9193e |
+ if (prev == NULL) {
|
|
|
ba9193e |
+ glxc->drawPriv->drawGlxc = curr->nextDrawPriv;
|
|
|
ba9193e |
+ } else {
|
|
|
ba9193e |
+ prev->nextDrawPriv = curr->nextDrawPriv;
|
|
|
ba9193e |
+ }
|
|
|
ba9193e |
+ curr->nextDrawPriv = NULL;
|
|
|
ba9193e |
+ __glXUnrefDrawable(glxc->drawPriv);
|
|
|
ba9193e |
+ break;
|
|
|
ba9193e |
}
|
|
|
ba9193e |
- curr->nextDrawPriv = NULL;
|
|
|
ba9193e |
- __glXUnrefDrawable(glxc->drawPriv);
|
|
|
ba9193e |
- break;
|
|
|
ba9193e |
- }
|
|
|
ba9193e |
+ }
|
|
|
ba9193e |
}
|
|
|
ba9193e |
|
|
|
ba9193e |
-
|
|
|
ba9193e |
prev = NULL;
|
|
|
ba9193e |
- for ( curr = glxc->readPriv->readGlxc
|
|
|
331a924 |
- ; curr != NULL
|
|
|
ba9193e |
- ; prev = curr, curr = curr->nextReadPriv ) {
|
|
|
ba9193e |
- if (curr == glxc) {
|
|
|
ba9193e |
- /* found context. Deassociate. */
|
|
|
ba9193e |
- if (prev == NULL) {
|
|
|
ba9193e |
- glxc->readPriv->readGlxc = curr->nextReadPriv;
|
|
|
ba9193e |
- } else {
|
|
|
ba9193e |
- prev->nextReadPriv = curr->nextReadPriv;
|
|
|
ba9193e |
- }
|
|
|
ba9193e |
- curr->nextReadPriv = NULL;
|
|
|
ba9193e |
- __glXUnrefDrawable(glxc->readPriv);
|
|
|
ba9193e |
- break;
|
|
|
ba9193e |
- }
|
|
|
ba9193e |
+ if (glxc->readPriv) {
|
|
|
ba9193e |
+ for ( curr = glxc->readPriv->readGlxc
|
|
|
ba9193e |
+ ; curr != NULL
|
|
|
ba9193e |
+ ; prev = curr, curr = curr->nextReadPriv ) {
|
|
|
ba9193e |
+ if (curr == glxc) {
|
|
|
ba9193e |
+ /* found context. Deassociate. */
|
|
|
ba9193e |
+ if (prev == NULL) {
|
|
|
ba9193e |
+ glxc->readPriv->readGlxc = curr->nextReadPriv;
|
|
|
ba9193e |
+ } else {
|
|
|
ba9193e |
+ prev->nextReadPriv = curr->nextReadPriv;
|
|
|
ba9193e |
+ }
|
|
|
ba9193e |
+ curr->nextReadPriv = NULL;
|
|
|
ba9193e |
+ __glXUnrefDrawable(glxc->readPriv);
|
|
|
ba9193e |
+ break;
|
|
|
ba9193e |
+ }
|
|
|
ba9193e |
+ }
|
|
|
ba9193e |
}
|
|
|
ba9193e |
}
|
|
|
ba9193e |
|
|
|
ba9193e |
--
|
|
|
ba9193e |
1.5.4.1
|
|
|
ba9193e |
|