added DestroyHeads() to test clean-up code
authorBrian Paul <brian.paul@tungstengraphics.com>
Tue, 23 Jan 2001 23:45:05 +0000 (23:45 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Tue, 23 Jan 2001 23:45:05 +0000 (23:45 +0000)
progs/xdemos/manywin.c

index 797029cc4cb5a6e4a3c917c307ac5986a2cdbea9..f8ef80d426aefd199162c8c8f47dd995e2408727 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: manywin.c,v 1.2 2000/12/02 20:33:05 brianp Exp $ */
+/* $Id: manywin.c,v 1.3 2001/01/23 23:45:05 brianp Exp $ */
 
 /*
  * Create N GLX windows/contexts and render to them in round-robin
@@ -163,6 +163,18 @@ AddHead(const char *displayName, const char *name)
 }
 
 
+static void
+DestroyHeads(void)
+{
+   int i;
+   for (i = 0; i < NumHeads; i++) {
+      XDestroyWindow(Heads[i].Dpy, Heads[i].Win);
+      glXDestroyContext(Heads[i].Dpy, Heads[i].Context);
+      XCloseDisplay(Heads[i].Dpy);
+   }
+}
+
+
 static void
 Redraw(struct head *h)
 {
@@ -311,7 +323,7 @@ main(int argc, char *argv[])
          char name[100];
          struct head *h;
          sprintf(name, "%d", i);
-         h = AddHead(":0", name);
+         h = AddHead(NULL, name);
          if (h) {
             PrintInfo(h);
          }
@@ -319,5 +331,6 @@ main(int argc, char *argv[])
    }
 
    EventLoop();
+   DestroyHeads();
    return 0;
 }