summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-03-04 13:04:43 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-03-10 19:21:20 +0000
commitf3af0686376c84844f2011a78fe075ed0d727062 (patch)
tree5a4e333784bacd01394d9c5cf7778a5f4f25ab60
parentd1d395774435d7759ef2b2af337222da79bc7264 (diff)
bus: never call xmlCleanupParser, unless just before exit() in a testwip-xmlCleanupParser-26032
I added this call to exactly those tests that are linked against the config-parser and run dbus_shutdown(). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=26032
-rw-r--r--bus/bus.c11
-rw-r--r--bus/bus.h2
-rw-r--r--bus/config-loader-expat.c10
-rw-r--r--bus/config-loader-libxml.c14
-rw-r--r--bus/config-parser.h2
-rw-r--r--bus/test-launch-helper.c1
-rw-r--r--bus/test-main.c2
-rw-r--r--bus/test-system.c1
8 files changed, 38 insertions, 5 deletions
diff --git a/bus/bus.c b/bus/bus.c
index 66633470..c94339fa 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -1664,3 +1664,14 @@ bus_context_check_security_policy (BusContext *context,
_dbus_verbose ("security policy allowing message\n");
return TRUE;
}
+
+/**
+ * Do not call this function unless you're about to exit(). It exists only to
+ * keep things like valgrind happy.
+ */
+void
+bus_self_destruct (void)
+{
+ bus_config_self_destruct ();
+ dbus_shutdown ();
+}
diff --git a/bus/bus.h b/bus/bus.h
index ebef17c7..6656d2ff 100644
--- a/bus/bus.h
+++ b/bus/bus.h
@@ -125,4 +125,6 @@ dbus_bool_t bus_context_check_security_policy (BusContext
DBusMessage *message,
DBusError *error);
+void bus_self_destruct (void);
+
#endif /* BUS_BUS_H */
diff --git a/bus/config-loader-expat.c b/bus/config-loader-expat.c
index b571fda3..e3bb9cf4 100644
--- a/bus/config-loader-expat.c
+++ b/bus/config-loader-expat.c
@@ -292,3 +292,13 @@ bus_config_load (const DBusString *file,
bus_config_parser_unref (parser);
return NULL;
}
+
+/**
+ * Do not call this function unless you're about to exit(). It exists only to
+ * keep things like valgrind happy.
+ */
+void
+bus_config_self_destruct (void)
+{
+ /* nothing to do in this backend */
+}
diff --git a/bus/config-loader-libxml.c b/bus/config-loader-libxml.c
index c73a1815..7844a8e7 100644
--- a/bus/config-loader-libxml.c
+++ b/bus/config-loader-libxml.c
@@ -306,8 +306,6 @@ bus_config_load (const DBusString *file,
goto failed;
_dbus_string_free (&dirname);
_dbus_string_free (&data);
- if (is_toplevel)
- xmlCleanupParser();
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
return parser;
@@ -315,10 +313,18 @@ bus_config_load (const DBusString *file,
_DBUS_ASSERT_ERROR_IS_SET (error);
_dbus_string_free (&dirname);
_dbus_string_free (&data);
- if (is_toplevel)
- xmlCleanupParser();
if (parser)
bus_config_parser_unref (parser);
_dbus_assert (reader == NULL); /* must go to reader_out first */
return NULL;
}
+
+/**
+ * Do not call this function unless you're about to exit(). It exists only to
+ * keep things like valgrind happy.
+ */
+void
+bus_config_self_destruct (void)
+{
+ xmlCleanupParser ();
+}
diff --git a/bus/config-parser.h b/bus/config-parser.h
index ba5bf749..3de2eb70 100644
--- a/bus/config-parser.h
+++ b/bus/config-parser.h
@@ -84,4 +84,6 @@ BusConfigParser* bus_config_load (const DBusString *file,
const BusConfigParser *parent,
DBusError *error);
+void bus_config_self_destruct (void);
+
#endif /* BUS_CONFIG_PARSER_H */
diff --git a/bus/test-launch-helper.c b/bus/test-launch-helper.c
index ab36b6ec..85b9696d 100644
--- a/bus/test-launch-helper.c
+++ b/bus/test-launch-helper.c
@@ -136,6 +136,7 @@ main (int argc, char **argv)
printf ("%s: Success\n", argv[0]);
+ bus_self_destruct ();
return 0;
#else /* DBUS_BUILD_TESTS */
diff --git a/bus/test-main.c b/bus/test-main.c
index cab75306..7dae94c9 100644
--- a/bus/test-main.c
+++ b/bus/test-main.c
@@ -181,7 +181,7 @@ main (int argc, char **argv)
printf ("%s: Success\n", argv[0]);
-
+ bus_self_destruct ();
return 0;
#else /* DBUS_BUILD_TESTS */
diff --git a/bus/test-system.c b/bus/test-system.c
index 56a7d4ea..b3beb348 100644
--- a/bus/test-system.c
+++ b/bus/test-system.c
@@ -97,6 +97,7 @@ main (int argc, char **argv)
printf ("%s: Success\n", argv[0]);
+ bus_self_destruct ();
return 0;
#else /* DBUS_BUILD_TESTS */