diff options
author | Debarshi Ray <debarshir@gnome.org> | 2014-09-21 11:32:27 +0200 |
---|---|---|
committer | Debarshi Ray <debarshir@gnome.org> | 2014-09-22 16:31:37 +0200 |
commit | b8e600a2e55284c77681eed8f874f775a9713e98 (patch) | |
tree | 2bedbcd1eb9ad680c9cfa188ae07735e58ba4e3d /src/libtracker-bus | |
parent | c240270f8a72d615042e75398df1d166b4d544fb (diff) | |
download | tracker-b8e600a2e55284c77681eed8f874f775a9713e98.tar.gz |
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
Diffstat (limited to 'src/libtracker-bus')
-rw-r--r-- | 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 9e6f0dd47..3b4b3809d 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); |