dbus/dbus dbus-connection-internal.h, 1.19, 1.20 dbus-connection.c,
1.90, 1.91 dbus-marshal-validate.c, 1.13,
1.14 dbus-message-private.h, 1.2, 1.3 dbus-message.c, 1.158,
1.159 dbus-object-tree.c, 1.11, 1.12
Havoc Pennington
hp at freedesktop.org
Sat Jan 29 23:44:11 PST 2005
Update of /cvs/dbus/dbus/dbus
In directory gabe:/tmp/cvs-serv18909/dbus
Modified Files:
dbus-connection-internal.h dbus-connection.c
dbus-marshal-validate.c dbus-message-private.h dbus-message.c
dbus-object-tree.c
Log Message:
2005-01-30 Havoc Pennington <hp at 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
Index: dbus-connection-internal.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection-internal.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- dbus-connection-internal.h 26 Nov 2004 01:53:13 -0000 1.19
+++ dbus-connection-internal.h 30 Jan 2005 07:44:08 -0000 1.20
@@ -89,7 +89,9 @@
int timeout_milliseconds);
void _dbus_pending_call_complete_and_unlock (DBusPendingCall *pending,
DBusMessage *message);
-
+dbus_bool_t _dbus_connection_send_unlocked (DBusConnection *connection,
+ DBusMessage *message,
+ dbus_uint32_t *client_serial);
/**
* @addtogroup DBusPendingCallInternals DBusPendingCall implementation details
Index: dbus-connection.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- dbus-connection.c 24 Jan 2005 21:44:35 -0000 1.90
+++ dbus-connection.c 30 Jan 2005 07:44:08 -0000 1.91
@@ -357,7 +357,7 @@
_dbus_connection_wakeup_mainloop (connection);
- _dbus_verbose ("Message %p (%d %s %s '%s') added to incoming queue %p, %d incoming\n",
+ _dbus_verbose ("Message %p (%d %s %s '%s' reply to %u) added to incoming queue %p, %d incoming\n",
message,
dbus_message_get_type (message),
dbus_message_get_interface (message) ?
@@ -367,6 +367,7 @@
dbus_message_get_member (message) :
"no member",
dbus_message_get_signature (message),
+ dbus_message_get_reply_serial (message),
connection,
connection->n_incoming);
}
@@ -1562,7 +1563,7 @@
sig = dbus_message_get_signature (message);
- _dbus_verbose ("Message %p (%d %s %s '%s') added to outgoing queue %p, %d pending to send\n",
+ _dbus_verbose ("Message %p (%d %s %s '%s') for %s added to outgoing queue %p, %d pending to send\n",
message,
dbus_message_get_type (message),
dbus_message_get_interface (message) ?
@@ -1572,6 +1573,9 @@
dbus_message_get_member (message) :
"no member",
sig,
+ dbus_message_get_destination (message) ?
+ dbus_message_get_destination (message) :
+ "null",
connection,
connection->n_outgoing);
@@ -1587,6 +1591,9 @@
if (client_serial)
*client_serial = dbus_message_get_serial (message);
}
+
+ _dbus_verbose ("Message %p serial is %u\n",
+ message, dbus_message_get_serial (message));
_dbus_message_lock (message);
@@ -1638,7 +1645,7 @@
CONNECTION_UNLOCK (connection);
}
-static dbus_bool_t
+dbus_bool_t
_dbus_connection_send_unlocked (DBusConnection *connection,
DBusMessage *message,
dbus_uint32_t *client_serial)
Index: dbus-marshal-validate.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-marshal-validate.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- dbus-marshal-validate.c 30 Jan 2005 05:18:44 -0000 1.13
+++ dbus-marshal-validate.c 30 Jan 2005 07:44:08 -0000 1.14
@@ -178,9 +178,11 @@
const unsigned char *a;
int alignment;
+#if 0
_dbus_verbose (" validating value of type %s type reader %p type_pos %d p %p end %p %d remain\n",
_dbus_type_to_string (current_type), reader, reader->type_pos, p, end,
(int) (end - p));
+#endif
/* Guarantee that p has one byte to look at */
if (p == end)
@@ -436,9 +438,11 @@
break;
}
+#if 0
_dbus_verbose (" validated value of type %s type reader %p type_pos %d p %p end %p %d remain\n",
_dbus_type_to_string (current_type), reader, reader->type_pos, p, end,
(int) (end - p));
+#endif
if (p > end)
{
Index: dbus-message-private.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message-private.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dbus-message-private.h 23 Jan 2005 06:10:07 -0000 1.2
+++ dbus-message-private.h 30 Jan 2005 07:44:08 -0000 1.3
@@ -97,6 +97,10 @@
unsigned int locked : 1; /**< Message being sent, no modifications allowed. */
+#ifndef DBUS_DISABLE_CHECKS
+ unsigned int in_cache : 1; /**< Has been "freed" since it's in the cache (this is a debug feature) */
+#endif
+
DBusList *size_counters; /**< 0-N DBusCounter used to track message size. */
long size_counter_delta; /**< Size we incremented the size counters by. */
Index: dbus-message.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.c,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- dbus-message.c 28 Jan 2005 05:30:53 -0000 1.158
+++ dbus-message.c 30 Jan 2005 07:44:08 -0000 1.159
@@ -456,6 +456,8 @@
_dbus_header_free (&message->header);
_dbus_string_free (&message->body);
+ _dbus_assert (message->refcount.value == 0);
+
dbus_free (message);
}
@@ -657,10 +659,15 @@
message_cache[i] = message;
message_cache_count += 1;
was_cached = TRUE;
+#ifndef DBUS_DISABLE_CHECKS
+ message->in_cache = TRUE;
+#endif
out:
_DBUS_UNLOCK (message_cache);
+ _dbus_assert (message->refcount.value == 0);
+
if (!was_cached)
dbus_message_finalize (message);
}
@@ -691,6 +698,9 @@
message->refcount.value = 1;
message->byte_order = DBUS_COMPILER_BYTE_ORDER;
message->locked = FALSE;
+#ifndef DBUS_DISABLE_CHECKS
+ message->in_cache = FALSE;
+#endif
message->size_counters = NULL;
message->size_counter_delta = 0;
message->changed_stamp = 0;
@@ -1067,7 +1077,8 @@
_dbus_return_val_if_fail (message != NULL, NULL);
_dbus_return_val_if_fail (message->generation == _dbus_current_generation, NULL);
-
+ _dbus_return_val_if_fail (!message->in_cache, NULL);
+
old_refcount = _dbus_atomic_inc (&message->refcount);
_dbus_assert (old_refcount >= 1);
@@ -1087,6 +1098,7 @@
_dbus_return_if_fail (message != NULL);
_dbus_return_if_fail (message->generation == _dbus_current_generation);
+ _dbus_return_if_fail (!message->in_cache);
old_refcount = _dbus_atomic_dec (&message->refcount);
Index: dbus-object-tree.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-object-tree.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- dbus-object-tree.c 30 Jan 2005 05:18:44 -0000 1.11
+++ dbus-object-tree.c 30 Jan 2005 07:44:08 -0000 1.12
@@ -615,11 +615,22 @@
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 @@
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;
}
More information about the dbus-commit
mailing list