]> git.cworth.org Git - apitrace/commitdiff
Disable BlockingIODevice with QJSON.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 5 Apr 2012 19:06:42 +0000 (20:06 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 5 Apr 2012 19:06:42 +0000 (20:06 +0100)
It looks like it doesn't work reliably in all cases, at least with
certain versions.

gui/retracer.cpp

index 84f974244943b45a551fd561a1f01ce8d8e108ac..983cd1a99f21f4f8f70c2c18ac49233afb737d53 100644 (file)
@@ -283,8 +283,6 @@ void Retracer::run()
             /*
              * Parse JSON from the output.
              *
-             * XXX: QJSON expects blocking IO.
-             *
              * XXX: QJSON's scanner is inneficient as it abuses single
              * character QIODevice::peek (not cheap), instead of maintaining a
              * lookahead character on its own.
@@ -292,7 +290,16 @@ void Retracer::run()
 
             bool ok = false;
             QJson::Parser jsonParser;
+#if 0
             parsedJson = jsonParser.parse(&io, &ok).toMap();
+#else
+            /*
+             * XXX: QJSON expects blocking IO, and it looks like
+             * BlockingIODevice does not work reliably in all cases.
+             */
+            process.waitForFinished(-1);
+            parsedJson = jsonParser.parse(&process, &ok).toMap();
+#endif
             if (!ok) {
                 msg = QLatin1String("failed to parse JSON");
             }