[tracker] libtracker-bus: Don't crash if query_async is cancelled



commit b8e600a2e55284c77681eed8f874f775a9713e98
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Sep 21 11:32:27 2014 +0200

    libtracker-bus: Don't crash if query_async is cancelled
    
    Always wait for send_query to finish. In case of any exceptions from
    splice_async we can not leave it hanging.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=737023

 src/libtracker-bus/tracker-bus.vala |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-bus/tracker-bus.vala b/src/libtracker-bus/tracker-bus.vala
index 9e6f0dd..3b4b380 100644
--- a/src/libtracker-bus/tracker-bus.vala
+++ b/src/libtracker-bus/tracker-bus.vala
@@ -93,12 +93,15 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
 
                // receive query results via FD
                var mem_stream = new MemoryOutputStream (null, GLib.realloc, GLib.free);
-               yield mem_stream.splice_async (input, OutputStreamSpliceFlags.CLOSE_SOURCE | 
OutputStreamSpliceFlags.CLOSE_TARGET, Priority.DEFAULT, cancellable);
 
-               // wait for D-Bus reply
-               received_result = true;
-               if (dbus_res == null) {
-                       yield;
+               try {
+                       yield mem_stream.splice_async (input, OutputStreamSpliceFlags.CLOSE_SOURCE | 
OutputStreamSpliceFlags.CLOSE_TARGET, Priority.DEFAULT, cancellable);
+               } finally {
+                       // wait for D-Bus reply
+                       received_result = true;
+                       if (dbus_res == null) {
+                               yield;
+                       }
                }
 
                var reply = bus.send_message_with_reply.end (dbus_res);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]