[gjs] [dbus-exports] Check for abandon_container



commit b82b4a2bc448e3a4e1183a3aec452322b50d6af9
Author: Colin Walters <walters verbum org>
Date:   Mon Jun 7 14:20:46 2010 -0400

    [dbus-exports] Check for abandon_container
    
    Only present in newer versions of dbus.  We'll leak without it,
    but the only way for this to fail right now is for someone to
    provide a wrong value, which will throw an exception, and quickly
    get noticed and fixed anyways.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=620876

 configure.ac           |    7 +++++++
 modules/dbus-exports.c |    2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2df0ad6..16f7e11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -183,6 +183,13 @@ PKG_CHECK_MODULES([GJS], [$gjs_packages])
 PKG_CHECK_MODULES([GJS_GI], [$gjs_gi_packages])
 PKG_CHECK_MODULES([GJS_CAIRO], [$gjs_cairo_packages])
 PKG_CHECK_MODULES([GJS_DBUS], [$gjs_dbus_packages])
+saved_CFLAGS=$CFLAGS
+CFLAGS=$GJS_DBUS_CFLAGS
+saved_LIBS=$LIBS
+LIBS=$GJS_DBUS_LIBS
+AC_CHECK_FUNCS(dbus_message_iter_abandon_container)
+CFLAGS=$saved_CFLAGS
+LIBS=$saved_LIBS
 PKG_CHECK_MODULES([GJSTESTS], [$gjstests_packages])
 
 if test x"$JS_PACKAGE" = x; then
diff --git a/modules/dbus-exports.c b/modules/dbus-exports.c
index 5bff0b2..99259a0 100644
--- a/modules/dbus-exports.c
+++ b/modules/dbus-exports.c
@@ -1199,7 +1199,9 @@ handle_get_all_properties(JSContext      *context,
             dbus_signature_iter_init(&sig_iter, details.signature);
             if (!gjs_js_one_value_to_dbus(context, value, &entry_value_iter,
                                           &sig_iter)) {
+#ifdef HAVE_DBUS_MESSAGE_ITER_ABANDON_CONTAINER
                 dbus_message_iter_abandon_container(&entry_iter, &entry_value_iter);
+#endif
                 JS_RemoveRoot(context, &value);
                 property_details_clear(&details);
                 goto js_exception;



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