diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-03-13 23:54:07 +0100 |
---|---|---|
committer | Mike Gorse <mgorse@suse.com> | 2022-09-09 10:46:58 -0500 |
commit | dedc322fc7764826f31140df7fef8650ba5ddae1 (patch) | |
tree | b68200dbee0685060ef19958f16c695b6441d081 | |
parent | 1050193e207ed010dda54baa246cddfa61afecc7 (diff) | |
download | at-spi2-core-dedc322fc7764826f31140df7fef8650ba5ddae1.tar.gz |
listeners: Fix crash on NULL listener
We shouldn't call _atspi_device_listener_get_path before checking that
listener is not NULL.
-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); |