From 9ef50cd056dcbc74caacca587f99b7892024dd42 Mon Sep 17 00:00:00 2001 From: billh Date: Tue, 7 Nov 2006 16:51:20 +0000 Subject: [PATCH] Leakfixes from Padraig O'Briain for bug #361386 and bug #369377. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@864 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- ChangeLog | 19 +++++++++++++++++++ registryd/deviceeventcontroller.c | 14 +++++++++++++- registryd/registry.c | 31 ++++++++++--------------------- 3 files changed, 42 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38dc0e6..b01ce61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2006-11-07 Bill Haneman + Patches from Padraig O'Briain for bugs #361386 and #369377. + + * registryd/registry.c: + (struct NotifyContext): Change the e_out + member from an Accessibility_Event struct to a pointer to + struct. + (notify_listeners_cb): Modify to use the new struct definition above. + Allows use of ORBit_copy_value instead of CORBA_any__copy. + + * registryd/deviceeventcontroller.c: + (spi_dec_button_update_and_emit): Free the event's any_data + after emission. + (spi_dec_mouse_check):Free the event details any struct + after emission. + (spi_device_event_controller_forward_mouse_event): Free any. + (spi_device_event_controller_forward_key_event): Ditto. + +2006-11-07 Bill Haneman + * configure.in: Uprev/release 1.7.13 for gnome 2.17.2. Don't require gtk+ and gail for building most of at-spi including libspi. diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c index 7e4e2e6..66cc323 100644 --- a/registryd/deviceeventcontroller.c +++ b/registryd/deviceeventcontroller.c @@ -458,6 +458,8 @@ spi_dec_button_update_and_emit (SpiDEController *controller, } else spi_dec_set_unlatch_pending (controller, mask_return); + + CORBA_free (e.any_data._value); } return TRUE; } @@ -473,6 +475,7 @@ spi_dec_mouse_check (SpiDEController *controller, int *x, int *y, gboolean *moved) { Accessibility_Event e; + Accessibility_EventDetails *details; CORBA_Environment ev; int win_x_return,win_y_return; unsigned int mask_return; @@ -510,6 +513,8 @@ spi_dec_mouse_check (SpiDEController *controller, Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry), &e, &ev); + details = e.any_data._value; + CORBA_free (details); e.type = "mouse:rel"; e.source = BONOBO_OBJREF (controller->registry->desktop); e.detail1 = *x - last_mouse_pos->x; @@ -524,6 +529,8 @@ spi_dec_mouse_check (SpiDEController *controller, Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry), &e, &ev); + details = e.any_data._value; + CORBA_free (details); *moved = True; } else @@ -564,6 +571,7 @@ spi_dec_emit_modifier_event (SpiDEController *controller, guint prev_mask, Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry), &e, &ev); + CORBA_free (e.any_data._value); } static gboolean @@ -1083,6 +1091,7 @@ spi_device_event_controller_forward_mouse_event (SpiDEController *controller, Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry), &e, &ev); + CORBA_free (e.any_data._value); } xkb_mod_unlatch_occurred = (xevent->type == ButtonPress || @@ -2509,6 +2518,7 @@ spi_device_event_controller_forward_key_event (SpiDEController *controller, { CORBA_Environment ev; Accessibility_DeviceEvent key_event; + gboolean ret; g_assert (event->type == KeyPress || event->type == KeyRelease); @@ -2520,7 +2530,9 @@ spi_device_event_controller_forward_key_event (SpiDEController *controller, spi_controller_update_key_grabs (controller, &key_event); /* relay to listeners, and decide whether to consume it or not */ - return spi_controller_notify_keylisteners (controller, &key_event, CORBA_TRUE, &ev); + ret = spi_controller_notify_keylisteners (controller, &key_event, CORBA_TRUE, &ev); + CORBA_free(key_event.event_string); + return ret; } SpiDEController * diff --git a/registryd/registry.c b/registryd/registry.c index c0e36bd..d3f1c6d 100644 --- a/registryd/registry.c +++ b/registryd/registry.c @@ -602,7 +602,7 @@ typedef struct { CORBA_Environment *ev; Bonobo_Unknown source; EventTypeStruct etype; - Accessibility_Event e_out; + Accessibility_Event *e_out; } NotifyContext; static SpiReEntrantContinue @@ -634,12 +634,12 @@ notify_listeners_cb (GList * const *list, gpointer user_data) } #endif - ctx->e_out.source = ctx->source; + ctx->e_out->source = ctx->source; if ((*list) && (*list)->data == ls) { Accessibility_EventListener_notifyEvent ( - (Accessibility_EventListener) ls->listener, &ctx->e_out, ctx->ev); + (Accessibility_EventListener) ls->listener, ctx->e_out, ctx->ev); if (ctx->ev->_major != CORBA_NO_EXCEPTION) { DBG (1, g_warning ("Accessibility app error: exception during " @@ -679,11 +679,7 @@ registry_clone_notify_context (NotifyContext *ctx) new_ctx->etype.major = ctx->etype.major; new_ctx->etype.minor = ctx->etype.minor; new_ctx->etype.detail = ctx->etype.detail; - new_ctx->e_out.type = CORBA_string_dup (ctx->e_out.type); - new_ctx->e_out.source = ctx->e_out.source; - new_ctx->e_out.detail1 = ctx->e_out.detail1; - new_ctx->e_out.detail2 = ctx->e_out.detail2; - CORBA_any__copy (&(new_ctx->e_out.any_data), &(ctx->e_out.any_data)); + new_ctx->e_out = ORBit_copy_value (ctx->e_out, TC_Accessibility_Event); return new_ctx; } @@ -717,9 +713,7 @@ registry_flush_event_queue (SpiRegistry *registry, bonobo_object_release_unref (q_ctx->source, NULL); } CORBA_free ((void *)q_ctx->etype.event_name); - CORBA_free ((void *)q_ctx->e_out.type); - if (q_ctx->e_out.any_data._type != TC_null) - CORBA_free ((void *)q_ctx->e_out.any_data._value); + CORBA_free (q_ctx->e_out); g_free (q_ctx); } registry->is_queueing = FALSE; @@ -834,25 +828,20 @@ registry_defer_on_event (SpiRegistry *registry, NotifyContext *ctx) static gboolean registry_queue_event (SpiRegistry *registry, NotifyContext *ctx) { - NotifyContext *q_ctx = registry_clone_notify_context (ctx); #ifdef SPI_QUEUE_DEBUG - if (q_ctx->etype.type_cat != ETYPE_MOUSE) - fprintf (stderr, "push! %s %p\n", q_ctx->etype.event_name, q_ctx); + if (ctx->etype.type_cat != ETYPE_MOUSE) + fprintf (stderr, "push! %s %p\n", ctx->etype.event_name, ctx); #endif if (registry->is_queueing) { + NotifyContext *q_ctx = registry_clone_notify_context (ctx); + g_queue_push_head (registry->deferred_event_queue, q_ctx); return FALSE; } else { - bonobo_object_release_unref (q_ctx->source, NULL); - CORBA_free ((void *)q_ctx->etype.event_name); - CORBA_free ((void *)q_ctx->e_out.type); - if (q_ctx->e_out.any_data._type != TC_null) - CORBA_free ((void *)q_ctx->e_out.any_data._value); - g_free (q_ctx); return TRUE; } } @@ -917,7 +906,7 @@ impl_registry_notify_event (PortableServer_Servant servant, parse_event_type (&ctx.etype, e->type); ctx.ev = ev; - ctx.e_out = *e; + ctx.e_out = (Accessibility_Event *)e; ctx.source = e->source; #ifdef SPI_QUEUE_DEBUG -- 2.7.4