]> git.cworth.org Git - apitrace/blobdiff - common/trace_parser.cpp
gui: Handle calls stranded between frames gracefully (issue #117).
[apitrace] / common / trace_parser.cpp
index 095af670e2159f79299fdba9bc4e642cbb4ac5e4..c70517e2461658cf18e8e6ca30c0d50b83c49c74 100644 (file)
@@ -187,8 +187,11 @@ Call *Parser::parse_call(Mode mode) {
             std::cerr << "\tLEAVE\n";
 #endif
             call = parse_leave(mode);
-            adjust_call_flags(call);
-            return call;
+            if (call) {
+                adjust_call_flags(call);
+                return call;
+            }
+            break;
         default:
             std::cerr << "error: unknown event " << c << "\n";
             exit(1);
@@ -456,6 +459,14 @@ Call *Parser::parse_leave(Mode mode) {
         }
     }
     if (!call) {
+        /* This might happen on random access, when an asynchronous call is stranded
+         * between two frames.  We won't return this call, but we still need to skip 
+         * over its data.
+         */
+        const FunctionSig sig = {0, NULL, 0, NULL};
+        call = new Call(&sig, 0, 0);
+        parse_call_details(call, SCAN);
+        delete call;
         return NULL;
     }