summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-object-tree.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2005-01-30 07:44:08 +0000
committerHavoc Pennington <hp@redhat.com>2005-01-30 07:44:08 +0000
commit98ad8a8ec6626f7f5c78915b6bdf2be688b4839f (patch)
treefb2744289e2f187aa7239d11bf8473fd186fa1ce /dbus/dbus-object-tree.c
parent41f52c96d651003b3d0a266a582d401228a8368e (diff)
2005-01-30 Havoc Pennington <hp@redhat.com>
* glib/dbus-gobject.c (introspect_properties): fix the XML generated * dbus/dbus-message.c (dbus_message_unref): add an in_cache flag which effectively detects the use of freed messages * glib/dbus-gobject.c (handle_introspect): modify and return the reply message instead of the incoming message * dbus/dbus-object-tree.c (handle_default_introspect_unlocked): gee, maybe it should SEND THE XML instead of just making a string and freeing it again ;-) * tools/dbus-print-message.c (print_message): improve printing of messages * configure.in: add debug-glib.service to the output
Diffstat (limited to 'dbus/dbus-object-tree.c')
-rw-r--r--dbus/dbus-object-tree.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/dbus/dbus-object-tree.c b/dbus/dbus-object-tree.c
index f8797595..da8d8c26 100644
--- a/dbus/dbus-object-tree.c
+++ b/dbus/dbus-object-tree.c
@@ -615,11 +615,22 @@ handle_default_introspect_unlocked (DBusObjectTree *tree,
DBusHandlerResult result;
char **children;
int i;
+ DBusMessage *reply;
+ DBusMessageIter iter;
+ const char *v_STRING;
+ /* We have the connection lock here */
+
+ _dbus_verbose (" considering default Introspect() handler...\n");
+
+ reply = NULL;
+
if (!dbus_message_is_method_call (message,
DBUS_INTERFACE_ORG_FREEDESKTOP_INTROSPECTABLE,
"Introspect"))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ _dbus_verbose (" using default Introspect() handler!\n");
if (!_dbus_string_init (&xml))
return DBUS_HANDLER_RESULT_NEED_MEMORY;
@@ -648,12 +659,31 @@ handle_default_introspect_unlocked (DBusObjectTree *tree,
if (!_dbus_string_append (&xml, "</node>\n"))
goto out;
+
+ reply = dbus_message_new_method_return (message);
+ if (reply == NULL)
+ goto out;
+
+ dbus_message_iter_init_append (reply, &iter);
+ v_STRING = _dbus_string_get_const_data (&xml);
+ if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &v_STRING))
+ goto out;
+
+#ifdef DBUS_BUILD_TESTS
+ if (tree->connection)
+#endif
+ {
+ if (!_dbus_connection_send_unlocked (tree->connection, reply, NULL))
+ goto out;
+ }
result = DBUS_HANDLER_RESULT_HANDLED;
out:
_dbus_string_free (&xml);
dbus_free_string_array (children);
+ if (reply)
+ dbus_message_unref (reply);
return result;
}