diff mbox

[Branch,~glcompbench-dev/glcompbench/trunk] Rev 61: CompositeCanvas, Main: Improve handling of canvas initialization errors.

Message ID 20110921135911.12692.1351.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org Sept. 21, 2011, 1:59 p.m. UTC
------------------------------------------------------------
revno: 61
committer: Alexandros Frantzis <alexandros.frantzis@linaro.org>
branch nick: trunk
timestamp: Wed 2011-09-21 16:57:01 +0300
message:
  CompositeCanvas,Main: Improve handling of canvas initialization errors.
modified:
  src/composite-canvas.cc
  src/glcompbench.cc


--
lp:glcompbench
https://code.launchpad.net/~glcompbench-dev/glcompbench/trunk

You are subscribed to branch lp:glcompbench.
To unsubscribe from this branch go to https://code.launchpad.net/~glcompbench-dev/glcompbench/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'src/composite-canvas.cc'
--- src/composite-canvas.cc	2011-08-03 14:34:10 +0000
+++ src/composite-canvas.cc	2011-09-21 13:57:01 +0000
@@ -220,7 +220,7 @@ 
                         vis_info->visual, mask, &attr);
 
     /* set hints and properties */
-    {
+    if (win) {
         XSizeHints sizehints;
         sizehints.x = x;
         sizehints.y = y;
@@ -231,6 +231,9 @@ 
         XSetStandardProperties(xdpy_, win, name, name,
                                None, NULL, 0, &sizehints);
     }
+    else {
+        Log::error("XCreateWindow() failed\n");
+    }
 
     return win;
 }
@@ -538,8 +541,10 @@ 
 {
     /* Open the display */
     xdpy_ = XOpenDisplay(NULL);
-    if (!xdpy_)
+    if (!xdpy_) {
+        Log::error("Error connecting to X Server. XOpenDisplay() failed.\n");
         return false;
+    }
 
     root_ = RootWindow(xdpy_, DefaultScreen(xdpy_));
 

=== modified file 'src/glcompbench.cc'
--- src/glcompbench.cc	2011-08-04 10:49:59 +0000
+++ src/glcompbench.cc	2011-09-21 13:57:01 +0000
@@ -202,8 +202,16 @@ 
         if (test_canvas != canvas && test_canvas != 0) {
             if (canvas)
                 canvas->deinit();
+
+            if (!test_canvas->init()) {
+                Log::error("Cannot initialize canvas of type '%s'. "
+                           "Skipping benchmark based on test '%s'.\n",
+                           test_canvas->type().c_str(),
+                           benchmark->get_test().name().c_str());
+                continue;
+            }
+
             canvas = test_canvas;
-            canvas->init();
             Log::info("=======================================================\n");
             Log::info("%s", canvas->info_string().c_str());
             Log::info("=======================================================\n");