xdemos/glsync: check glXMakeCurrent return value
authorJesse Barnes <jbarnes@virtuousgeek.org>
Mon, 4 Jan 2010 18:13:57 +0000 (13:13 -0500)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Fri, 8 Jan 2010 17:37:43 +0000 (12:37 -0500)
Since this program is used for testing, catching this case can be helpful.

progs/xdemos/glsync.c

index 0608f75534d4aa81fbe1d01f0be6eef4b8a0023e..6108d991d01fdf3bd5ea66f6fb9634ae4eb5ba49 100644 (file)
@@ -120,6 +120,7 @@ int main(int argc, char *argv[])
        int width = 500, height = 500, verbose = 0,
                countonly = 0, interval = 1;
        int c, i = 1;
+       int ret;
        int attribs[] = { GLX_RGBA,
                      GLX_RED_SIZE, 1,
                      GLX_GREEN_SIZE, 1,
@@ -234,7 +235,10 @@ int main(int argc, char *argv[])
        }
 
        XMapWindow(disp, winGL);
-       glXMakeCurrent(disp, winGL, context);
+       ret = glXMakeCurrent(disp, winGL, context);
+       if (ret) {
+               fprintf(stderr, "failed to make context current: %d\n", ret);
+       }
 
        video_sync_get = glXGetProcAddress((unsigned char *)"glXGetVideoSyncSGI");
        video_sync = glXGetProcAddress((unsigned char *)"glXWaitVideoSyncSGI");