summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2009-11-09 17:51:03 -0500
committerAdam Jackson <ajax@redhat.com>2009-11-10 15:31:09 -0500
commit2e07e9d4f300e8153e4e93cd78bc51e0d91dba6f (patch)
tree03b787fd7e88f9d8a3b1d1a778378236e1bb299a
parent7b41b589213293793182b61f20006229a89d5ba7 (diff)
GetCrtcGamma: Fix error handling.
We didn't treat _XReply failure as fatal. Parsing an xError as a gamma ramp reply doesn't work that often. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
-rw-r--r--src/XrrCrtc.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/XrrCrtc.c b/src/XrrCrtc.c
index 3f048e2..697987a 100644
--- a/src/XrrCrtc.c
+++ b/src/XrrCrtc.c
@@ -179,7 +179,7 @@ XRRGetCrtcGamma (Display *dpy, RRCrtc crtc)
XExtDisplayInfo *info = XRRFindDisplay(dpy);
xRRGetCrtcGammaReply rep;
xRRGetCrtcGammaReq *req;
- XRRCrtcGamma *crtc_gamma;
+ XRRCrtcGamma *crtc_gamma = NULL;
long nbytes;
long nbytesRead;
@@ -192,7 +192,7 @@ XRRGetCrtcGamma (Display *dpy, RRCrtc crtc)
req->crtc = crtc;
if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
- rep.status = RRSetConfigFailed;
+ goto out;
nbytes = (long) rep.length << 2;
@@ -204,9 +204,7 @@ XRRGetCrtcGamma (Display *dpy, RRCrtc crtc)
if (!crtc_gamma)
{
_XEatData (dpy, (unsigned long) nbytes);
- UnlockDisplay (dpy);
- SyncHandle ();
- return NULL;
+ goto out;
}
_XRead16 (dpy, crtc_gamma->red, rep.size * 2);
_XRead16 (dpy, crtc_gamma->green, rep.size * 2);
@@ -214,7 +212,8 @@ XRRGetCrtcGamma (Display *dpy, RRCrtc crtc)
if (nbytes > nbytesRead)
_XEatData (dpy, (unsigned long) (nbytes - nbytesRead));
-
+
+out:
UnlockDisplay (dpy);
SyncHandle ();
return crtc_gamma;