This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 configure.ac |   63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 configure.in |   63 ----------------------------------------------------------
 src/object.c |   20 +++++++++++++++--
 3 files changed, 80 insertions(+), 66 deletions(-)

New commits:
commit 115b6cce0cc05385d92b0cdd4de9680b840352c8
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 18:56:33 2008 +0200

    Use configure.ac as it is the preferred name

commit 9e96781f0e9495ac8efe3b81df968d4ac505e4e8
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 07:31:49 2008 +0200

    Protect the interface list with a static mutex


Diff in this email is a maximum of 400 lines.
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..5d069cd
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,63 @@
+AC_PREREQ(2.50)
+AC_INIT()
+
+AM_INIT_AUTOMAKE(libgdbus, 0.0)
+AM_CONFIG_HEADER(config.h)
+
+AM_MAINTAINER_MODE
+
+AC_PREFIX_DEFAULT(/usr/local)
+
+if (test "${CFLAGS}" = ""); then
+       CFLAGS="-Wall -O2"
+fi
+
+AC_LANG_C
+
+AC_PROG_CC
+AC_PROG_INSTALL
+
+m4_define([_LT_AC_TAGCONFIG], [])
+m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
+
+AC_PROG_LIBTOOL
+
+AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
+                       [enable compiling with debugging information]), [
+       if (test "${enableval}" = "yes" &&
+                               test "${ac_cv_prog_cc_g}" = "yes"); then
+               CFLAGS="$CFLAGS -g -O0"
+       fi
+])
+
+AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
+                       [enable position independent executables flag]), [
+       if (test "${enableval}" = "yes" &&
+                               test "${ac_cv_prog_cc_pie}" = "yes"); then
+               CFLAGS="$CFLAGS -fPIE"
+               LDFLAGS="$LDFLAGS -pie"
+       fi
+])
+
+AC_PATH_PROG(DOXYGEN, [doxygen])
+
+AC_ARG_ENABLE(doxygen, AS_HELP_STRING([--enable-doxygen],
+       [build documentation (requires Doxygen)]), dummy=yes, DOXYGEN="")
+
+PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.10, dummy=yes,
+                               AC_MSG_ERROR(glib >= 2.10 is required))
+
+PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
+                               AC_MSG_ERROR(dbus >= 1.0 is required))
+
+AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
+       AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
+               [Define to 1 if you need the dbus_watch_get_unix_fd() 
function.]))
+
+AC_SUBST(DBUS_CFLAGS)
+AC_SUBST(DBUS_LIBS)
+
+AC_SUBST(GLIB_CFLAGS)
+AC_SUBST(GLIB_LIBS)
+
+AC_OUTPUT(Makefile src/Makefile test/Makefile doc/Makefile doc/Doxyfile 
gdbus.pc)
diff --git a/configure.in b/configure.in
deleted file mode 100644
index 5d069cd..0000000
--- a/configure.in
+++ /dev/null
@@ -1,63 +0,0 @@
-AC_PREREQ(2.50)
-AC_INIT()
-
-AM_INIT_AUTOMAKE(libgdbus, 0.0)
-AM_CONFIG_HEADER(config.h)
-
-AM_MAINTAINER_MODE
-
-AC_PREFIX_DEFAULT(/usr/local)
-
-if (test "${CFLAGS}" = ""); then
-       CFLAGS="-Wall -O2"
-fi
-
-AC_LANG_C
-
-AC_PROG_CC
-AC_PROG_INSTALL
-
-m4_define([_LT_AC_TAGCONFIG], [])
-m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
-
-AC_PROG_LIBTOOL
-
-AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
-                       [enable compiling with debugging information]), [
-       if (test "${enableval}" = "yes" &&
-                               test "${ac_cv_prog_cc_g}" = "yes"); then
-               CFLAGS="$CFLAGS -g -O0"
-       fi
-])
-
-AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
-                       [enable position independent executables flag]), [
-       if (test "${enableval}" = "yes" &&
-                               test "${ac_cv_prog_cc_pie}" = "yes"); then
-               CFLAGS="$CFLAGS -fPIE"
-               LDFLAGS="$LDFLAGS -pie"
-       fi
-])
-
-AC_PATH_PROG(DOXYGEN, [doxygen])
-
-AC_ARG_ENABLE(doxygen, AS_HELP_STRING([--enable-doxygen],
-       [build documentation (requires Doxygen)]), dummy=yes, DOXYGEN="")
-
-PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.10, dummy=yes,
-                               AC_MSG_ERROR(glib >= 2.10 is required))
-
-PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
-                               AC_MSG_ERROR(dbus >= 1.0 is required))
-
-AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
-       AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
-               [Define to 1 if you need the dbus_watch_get_unix_fd() 
function.]))
-
-AC_SUBST(DBUS_CFLAGS)
-AC_SUBST(DBUS_LIBS)
-
-AC_SUBST(GLIB_CFLAGS)
-AC_SUBST(GLIB_LIBS)
-
-AC_OUTPUT(Makefile src/Makefile test/Makefile doc/Makefile doc/Doxyfile 
gdbus.pc)
diff --git a/src/object.c b/src/object.c
index baf5bbe..61dea22 100644
--- a/src/object.c
+++ b/src/object.c
@@ -41,7 +41,9 @@ typedef struct {
 } ConnectionData;
 
 typedef struct {
+       gint refcount;
        char *path;
+       GStaticMutex mutex;
        GSList *interfaces;
        char *introspect;
 } ObjectData;
@@ -696,6 +698,10 @@ static gboolean g_dbus_register_object(DBusConnection 
*connection,
 
        object = g_new0(ObjectData, 1);
 
+       object->refcount = 1;
+
+       g_static_mutex_init(&object->mutex);
+
        object->path = g_strdup(path);
        object->interfaces = NULL;
        object->introspect = generate_introspect(connection, path, object);
@@ -935,11 +941,15 @@ gboolean g_dbus_register_interface(DBusConnection 
*connection,
        interface->user_data = user_data;
        interface->destroy = destroy;
 
+       g_static_mutex_lock(&object->mutex);
+
        object->interfaces = g_slist_append(object->interfaces, interface);
 
        g_free(object->introspect);
        object->introspect = generate_introspect(connection, path, object);
 
+       g_static_mutex_unlock(&object->mutex);
+
        return TRUE;
 }
 
@@ -972,14 +982,18 @@ gboolean g_dbus_unregister_interface(DBusConnection 
*connection,
        if (interface == NULL)
                return FALSE;
 
-       object->interfaces = g_slist_remove(object->interfaces, interface);
+       g_static_mutex_lock(&object->mutex);
 
-       g_free(interface->name);
-       g_free(interface);
+       object->interfaces = g_slist_remove(object->interfaces, interface);
 
        g_free(object->introspect);
        object->introspect = generate_introspect(connection, path, object);
 
+       g_static_mutex_unlock(&object->mutex);
+
+       g_free(interface->name);
+       g_free(interface);
+
        g_dbus_unregister_object(connection, path);
 
        return TRUE;
_______________________________________________
Commits mailing list
[email protected]
https://www.moblin.org/mailman/listinfo/commits

Reply via email to