[at-spi2-core] Don't pass empty property array to RegisterEvent
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core] Don't pass empty property array to RegisterEvent
- Date: Mon, 24 Feb 2014 23:15:32 +0000 (UTC)
commit 902f2cc4e7b6b158411d9e8f5af473a5bf0624b2
Author: Mike Gorse <mgorse suse com>
Date: Mon Feb 24 17:11:22 2014 -0600
Don't pass empty property array to RegisterEvent
Apparently, for some reason unknown to me, it is sometimes possible for
a jhbuild session to be running an at-spi2-registryd from the system
directory, rather than the jhbuild install, so it is useful to be
compatible with at-spi2-registryd <= 3.10. So, for now, if no properties
are being requested with an event, then let's leave off the (empty)
array.
Also modify at-spi2-registryd to accept the old form of RegisterEvent.
We may want to revert this eventually; it would be cleaner not to send
two different forms of RegisterEvent.
atspi/atspi-event-listener.c | 19 +++++++++++++------
registryd/registry.c | 20 ++++++++++++--------
2 files changed, 25 insertions(+), 14 deletions(-)
---
diff --git a/atspi/atspi-event-listener.c b/atspi/atspi-event-listener.c
index 3e6e73a..752d440 100644
--- a/atspi/atspi-event-listener.c
+++ b/atspi/atspi-event-listener.c
@@ -551,12 +551,19 @@ static gboolean
notify_event_registered (EventListenerEntry *e)
{
- dbind_method_call_reentrant (_atspi_bus (), atspi_bus_registry,
- atspi_path_registry,
- atspi_interface_registry,
- "RegisterEvent",
- NULL, "sas", e->event_type,
- e->properties);
+ if (e->properties)
+ dbind_method_call_reentrant (_atspi_bus (), atspi_bus_registry,
+ atspi_path_registry,
+ atspi_interface_registry,
+ "RegisterEvent",
+ NULL, "sas", e->event_type,
+ e->properties);
+ else
+ dbind_method_call_reentrant (_atspi_bus (), atspi_bus_registry,
+ atspi_path_registry,
+ atspi_interface_registry,
+ "RegisterEvent",
+ NULL, "s", e->event_type);
return TRUE;
}
diff --git a/registryd/registry.c b/registryd/registry.c
index 6f37a96..c533eb0 100644
--- a/registryd/registry.c
+++ b/registryd/registry.c
@@ -837,7 +837,8 @@ impl_register_event (DBusConnection *bus, DBusMessage *message, void *user_data)
DBusMessageIter iter, iter_array;
const char *signature = dbus_message_get_signature (message);
- if (strcmp (signature, "sas") != 0)
+ if (strcmp (signature, "sas") != 0 &&
+ strcmp (signature, "s") != 0)
{
g_warning ("got RegisterEvent with invalid signature '%s'", signature);
return NULL;
@@ -846,7 +847,6 @@ impl_register_event (DBusConnection *bus, DBusMessage *message, void *user_data)
dbus_message_iter_init (message, &iter);
dbus_message_iter_get_basic (&iter, &orig_name);
dbus_message_iter_next (&iter);
- dbus_message_iter_recurse (&iter, &iter_array);
name = ensure_proper_format (orig_name);
evdata = g_new0 (event_data, 1);
@@ -854,13 +854,17 @@ impl_register_event (DBusConnection *bus, DBusMessage *message, void *user_data)
evdata->bus_name = g_strdup (sender);
evdata->data = data;
- while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID)
+ if (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_ARRAY)
{
- const char *property;
- dbus_message_iter_get_basic (&iter_array, &property);
- evdata->properties = g_slist_append (evdata->properties,
- g_strdup (property));
- dbus_message_iter_next (&iter_array);
+ dbus_message_iter_recurse (&iter, &iter_array);
+ while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID)
+ {
+ const char *property;
+ dbus_message_iter_get_basic (&iter_array, &property);
+ evdata->properties = g_slist_append (evdata->properties,
+ g_strdup (property));
+ dbus_message_iter_next (&iter_array);
+ }
}
registry->events = g_list_append (registry->events, evdata);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]