diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-03-13 23:54:07 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-03-13 23:54:26 +0100 |
commit | 668cf72b6f2607546fb8701efff34445cadc0c37 (patch) | |
tree | ca73d898e6a4fc389399c6b542f39e0e73ff00a1 /atspi/atspi-registry.c | |
parent | 68367675465c409af3fa701bd3f4b299cbfe183f (diff) | |
download | at-spi2-core-668cf72b6f2607546fb8701efff34445cadc0c37.tar.gz |
listeners: Fix crash on NULL listener
We shouldn't call _atspi_device_listener_get_path before checking that
listener is not NULL.
Diffstat (limited to 'atspi/atspi-registry.c')
-rw-r--r-- | atspi/atspi-registry.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/atspi/atspi-registry.c b/atspi/atspi-registry.c index dea5878e..382308fd 100644 --- a/atspi/atspi-registry.c +++ b/atspi/atspi-registry.c @@ -270,19 +270,22 @@ atspi_deregister_keystroke_listener (AtspiDeviceListener *listener, GError **error) { GArray *d_key_set; - gchar *path = _atspi_device_listener_get_path (listener); + gchar *path; gint i; dbus_uint32_t d_modmask = modmask; dbus_uint32_t d_event_types = event_types; DBusError d_error; GList *l; - dbus_error_init (&d_error); if (!listener) { return FALSE; } + dbus_error_init (&d_error); + + path = _atspi_device_listener_get_path (listener); + /* copy the keyval filter values from the C api into the DBind KeySet */ if (key_set) { @@ -363,15 +366,18 @@ atspi_register_device_event_listener (AtspiDeviceListener *listener, { gboolean retval = FALSE; dbus_uint32_t d_event_types = event_types; - gchar *path = _atspi_device_listener_get_path (listener); + gchar *path; DBusError d_error; - dbus_error_init (&d_error); if (!listener) { return retval; } + dbus_error_init (&d_error); + + path = _atspi_device_listener_get_path (listener); + dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "RegisterDeviceEventListener", &d_error, "ou=>b", path, d_event_types, &retval); if (dbus_error_is_set (&d_error)) { @@ -400,16 +406,18 @@ atspi_deregister_device_event_listener (AtspiDeviceListener *listener, void *filter, GError **error) { dbus_uint32_t event_types = 0; - gchar *path = _atspi_device_listener_get_path (listener); + gchar *path; DBusError d_error; - dbus_error_init (&d_error); - if (!listener) { return FALSE; } + dbus_error_init (&d_error); + + path = _atspi_device_listener_get_path (listener); + event_types |= (1 << ATSPI_BUTTON_PRESSED_EVENT); event_types |= (1 << ATSPI_BUTTON_RELEASED_EVENT); |