[at-spi2-core: 1/2] listeners: Fix crash on NULL listener
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core: 1/2] listeners: Fix crash on NULL listener
- Date: Thu, 24 Mar 2022 15:27:07 +0000 (UTC)
commit 668cf72b6f2607546fb8701efff34445cadc0c37
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date: Sun Mar 13 23:54:07 2022 +0100
listeners: Fix crash on NULL listener
We shouldn't call _atspi_device_listener_get_path before checking that
listener is not NULL.
atspi/atspi-registry.c | 22 +++++++++++++++-------
1 file 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]