Properly clean up when timing out on a keystroke listener
authorMike Gorse <mgorse@suse.com>
Thu, 5 Sep 2013 03:29:15 +0000 (22:29 -0500)
committerMike Gorse <mgorse@suse.com>
Thu, 5 Sep 2013 03:29:15 +0000 (22:29 -0500)
If we time out waiting for a keystroke listener, then exit the main
loop, and reset the DBus connections' main loop contexts becak to the
default loop.

https://bugzilla.gnome.org/show_big.cgi?id=707218

atk-adaptor/event.c

index 8e8dd89..d8a74cc 100644 (file)
@@ -88,8 +88,8 @@ timeout_reply (void *data)
 {
   SpiReentrantCallClosure *closure = data;
 
-  if (!dbus_connection_get_is_connected (closure->bus))
-    g_main_loop_quit (closure->loop);
+  switch_main_context (NULL);
+  g_main_loop_quit (closure->loop);
   closure->timeout = -1;
   return FALSE;
 }
@@ -121,6 +121,8 @@ send_and_allow_reentry (DBusConnection * bus, DBusMessage * message)
     g_source_destroy (source);
   
   g_main_loop_unref (closure.loop);
+  if (!closure.reply)
+    dbus_pending_call_cancel (pending);
   return closure.reply;
 }