Disable for dbus-glib prior to 0.9.0
authorMike Gorse <mgorse@novell.com>
Fri, 3 Dec 2010 20:44:48 +0000 (15:44 -0500)
committerMike Gorse <mgorse@novell.com>
Fri, 3 Dec 2010 20:44:48 +0000 (15:44 -0500)
The main loop switching code will result in a hang in dbus-glib 0.88 and
earlier because of FDO#30574, so added a configure check to warn and disable
p2p for older dbus-glib versions.

atk-adaptor/Makefile.include
atk-adaptor/adaptors/Makefile.am
atk-adaptor/bridge.c
atk-adaptor/event.c
configure.ac
droute/Makefile.am

index 3cc3ef3..b5f6bed 100644 (file)
@@ -4,7 +4,7 @@ libatk_bridge_la_CFLAGS = $(DBUS_GLIB_CFLAGS) \
                          $(ATK_CFLAGS)       \
                          -I$(top_srcdir)     \
                          -I$(top_srcdir)/atk-adaptor/adaptors \
-       -DG_DISABLE_DEPRECATED
+       $(P2P_CFLAGS)
 
 libatk_bridge_la_LDFLAGS = -no-undefined  \
                           -module        \
index 460d928..6bba900 100644 (file)
@@ -5,7 +5,7 @@ libatk_bridge_adaptors_la_CFLAGS =\
                          $(ATK_CFLAGS)       \
                          -I$(top_srcdir)     \
                          -I$(top_srcdir)/atk-adaptor \
-       -DG_DISABLE_DEPRECATED
+       $(P2P_CFLAGS)
 
 libatk_bridge_adaptors_la_LIBADD =\
                          $(DBUS_GLIB_LIBS) \
index 6747a4d..398ebda 100644 (file)
@@ -320,8 +320,10 @@ register_application (SpiBridge * app)
 /* make sure the directory exists */
 mkdir("/tmp/at-spi2/", S_IRWXU);
 app->app_bus_addr = g_malloc(max_addr_length * sizeof(char));
+#ifndef DISABLE_P2P
 sprintf(app->app_bus_addr, "unix:path=/tmp/at-spi2/socket-%d-%d", getpid(),
 rand());
+#endif
 
   return TRUE;
 }
@@ -517,6 +519,7 @@ new_connection_cb (DBusServer *server, DBusConnection *con, void *data)
 static int
 setup_bus (void)
 {
+#ifndef DISABLE_P2P
   DBusServer *server;
   DBusError err;
 
@@ -531,6 +534,7 @@ setup_bus (void)
   dbus_server_set_new_connection_function(server, new_connection_cb, NULL, NULL);
 
   spi_global_app_data->server = server;
+#endif
 
   return 0;
 }
index 0de5bb0..503e454 100644 (file)
@@ -55,12 +55,15 @@ typedef struct _SpiReentrantCallClosure
 static void
 switch_main_context (GMainContext *cnx)
 {
+#ifndef DISABLE_P2P
+/* This code won't work on dbus-glib earlier than 0.9.0 because of FDO#30574 */
   GList *list;
 
   dbus_server_setup_with_g_main (spi_global_app_data->server, cnx);
   dbus_connection_setup_with_g_main (spi_global_app_data->bus, cnx);
   for (list = spi_global_app_data->direct_connections; list; list = list->next)
     dbus_connection_setup_with_g_main (list->data, cnx);
+#endif
 }
 
 static void
index dfc05d5..c1c7397 100644 (file)
@@ -43,7 +43,10 @@ PKG_CHECK_MODULES(GLIB, [glib-2.0])
 AC_SUBST(GLIB_LIBS)
 AC_SUBST(GLIB_CFLAGS)
 
-PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.7.0])
+PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= 0.90, dbus_glib=yes, dbus_glib=no)
+if test "x$dbus_glib" = "xno"; then
+       PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= 0.7.0, dbus_glib_old=yes)
+fi
 AC_SUBST(DBUS_GLIB_LIBS)
 AC_SUBST(DBUS_GLIB_CFLAGS)
 
@@ -105,6 +108,12 @@ DBIND_CHECK_ALIGNOF(dbind_pointer)
 DBIND_CHECK_ALIGNOF(dbind_struct)
 CPPFLAGS=$orig_CPPFLAGS 
 
+if test "x$dbus_glib_old" = "xyes"; then
+       P2P_CFLAGS=-DDISABLE_P2P
+       AC_MSG_WARN([found dbus-glib older than 0.9.0; disabling peer-to-peer support])
+fi
+AC_SUBST(P2P_CFLAGS)
+
 AC_CONFIG_FILES([Makefile
                 dbind/dbind-config.h
                 dbind/Makefile
index c8b34b8..94cefaf 100644 (file)
@@ -2,8 +2,7 @@ noinst_LTLIBRARIES = libdroute.la
 
 libdroute_la_CFLAGS = $(DBUS_GLIB_CFLAGS) \
                       -I$(top_builddir)\
-                      -I$(top_srcdir) \
-                      -DG_DISABLE_DEPRECATED
+                      -I$(top_srcdir)
 
 libdroute_la_SOURCES =\
                droute.c\
@@ -20,8 +19,7 @@ check_PROGRAMS = droute-test
 droute_test_SOURCES  = droute-test.c
 droute_test_CFLAGS = $(DBUS_GLIB_CFLAGS) \
                     -I$(top_builddir)\
-                    -I$(top_srcdir) \
-       -DG_DISABLE_DEPRECATED
+                    -I$(top_srcdir)
 
 droute_test_LDFLAGS  = $(top_builddir)/dbind/libdbind.la\
                       libdroute.la\