[at-spi2-atk: 12/14] Disable for dbus-glib prior to 0.9.0



commit 344deddcec79cb4611010a7c8655755f5d05350e
Author: Mike Gorse <mgorse novell com>
Date:   Fri Dec 3 15:44:48 2010 -0500

    Disable for dbus-glib prior to 0.9.0
    
    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     |    2 +-
 atk-adaptor/adaptors/Makefile.am |    2 +-
 atk-adaptor/bridge.c             |    4 ++++
 atk-adaptor/event.c              |    3 +++
 configure.ac                     |   11 ++++++++++-
 droute/Makefile.am               |    6 ++----
 6 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/atk-adaptor/Makefile.include b/atk-adaptor/Makefile.include
index 3cc3ef3..b5f6bed 100644
--- a/atk-adaptor/Makefile.include
+++ b/atk-adaptor/Makefile.include
@@ -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        \
diff --git a/atk-adaptor/adaptors/Makefile.am b/atk-adaptor/adaptors/Makefile.am
index 460d928..6bba900 100644
--- a/atk-adaptor/adaptors/Makefile.am
+++ b/atk-adaptor/adaptors/Makefile.am
@@ -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) \
diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c
index 6747a4d..398ebda 100644
--- a/atk-adaptor/bridge.c
+++ b/atk-adaptor/bridge.c
@@ -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;
 }
diff --git a/atk-adaptor/event.c b/atk-adaptor/event.c
index 0de5bb0..503e454 100644
--- a/atk-adaptor/event.c
+++ b/atk-adaptor/event.c
@@ -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
diff --git a/configure.ac b/configure.ac
index dfc05d5..c1c7397 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/droute/Makefile.am b/droute/Makefile.am
index c8b34b8..94cefaf 100644
--- a/droute/Makefile.am
+++ b/droute/Makefile.am
@@ -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\



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