Fix deadlock with key event listeners in our own process
authorMike Gorse <mgorse@suse.com>
Mon, 1 Jul 2013 19:35:04 +0000 (14:35 -0500)
committerMike Gorse <mgorse@suse.com>
Mon, 1 Jul 2013 19:35:04 +0000 (14:35 -0500)
If a key event was sent out and there was also a listener in the same
process, then the listener would never see the event, since the main
loop was being run in a separate context, while libatspi would defer
handling of the event, adding an idle handler into the default context.
We should call atspi_set_main_context (new function) to let libatspi
know which context to use when adding an idle callback. This was
previously hacked around by setting ATSPI_CLIENT in pyatspi and avoiding
switching main loop contexts if it was set, but this was specific to
pyatspi (ie, did not take into account direct usage of libatspi or use
directly through introspection, such as in Javascript), so this check
was removed in 2.9.3.

atk-adaptor/event.c
configure.ac

index dc4e3ec68085525e3c4bc287922d31eade8c19cd..8e8dd8916906a7746dd65655f0144eb7bbf69cff 100644 (file)
@@ -67,6 +67,7 @@ switch_main_context (GMainContext *cnx)
   if (spi_global_app_data->server)
     atspi_dbus_server_setup_with_g_main (spi_global_app_data->server, cnx);
   atspi_dbus_connection_setup_with_g_main (spi_global_app_data->bus, cnx);
+  atspi_set_main_context (cnx);
   for (list = spi_global_app_data->direct_connections; list; list = list->next)
     atspi_dbus_connection_setup_with_g_main (list->data, cnx);
 }
index 126c8395e60eaf0b05c7ecd002f1e86dc695a567..4292a99272be6e45524342545a7c40230146c937 100644 (file)
@@ -55,7 +55,7 @@ PKG_CHECK_MODULES(ATK, [atk >= 2.7.90])
 AC_SUBST(ATK_LIBS)
 AC_SUBST(ATK_CFLAGS)
 
-PKG_CHECK_MODULES(ATSPI, [atspi-2 >= 2.9.3])
+PKG_CHECK_MODULES(ATSPI, [atspi-2 >= 2.9.4])
 AC_SUBST(ATSPI_LIBS)
 AC_SUBST(ATSPI_CFLAGS)