From 3b85382d4f1f6ee06ceb41f4f678b045bf8955d2 Mon Sep 17 00:00:00 2001 From: padraigo Date: Mon, 7 Jul 2003 09:49:37 +0000 Subject: [PATCH] 2003-07-07 Padraig O'Briain * cspi/spi_event.c (AccessibleEvent_unref): Update code to free resources allocated for AccessibleEvent. See cspi_event(). * cspi/spi_streamablecontent.c (cspi_streams_close_all): Set static variable streams to NULL. * cspi/bonobo/cspi-bonobo-listener.c (cspi_event): Update so that AcessibleEvent_ref will work. This fixes bug #116624. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@477 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- ChangeLog | 13 +++++++++++++ cspi/bonobo/cspi-bonobo-listener.c | 26 ++++++++++++++++---------- cspi/spi_event.c | 7 ++++++- cspi/spi_streamablecontent.c | 6 +++++- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8545b28..83a302a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2003-07-07 Padraig O'Briain + + * cspi/spi_event.c (AccessibleEvent_unref): Update code to free + resources allocated for AccessibleEvent. See cspi_event(). + + * cspi/spi_streamablecontent.c (cspi_streams_close_all): Set + static variable streams to NULL. + + * cspi/bonobo/cspi-bonobo-listener.c (cspi_event): + Update so that AcessibleEvent_ref will work. + + This fixes bug #116624. + 2003-07-06 Jordi Mallach * configure.in (ALL_LINGUAS): Added "ca" (Catalan). diff --git a/cspi/bonobo/cspi-bonobo-listener.c b/cspi/bonobo/cspi-bonobo-listener.c index 6b7316f..96d4025 100644 --- a/cspi/bonobo/cspi-bonobo-listener.c +++ b/cspi/bonobo/cspi-bonobo-listener.c @@ -93,26 +93,32 @@ cspi_event (SpiEventListener *listener, { GList *l; CSpiEventListener *clistener = (CSpiEventListener *) listener; - InternalEvent aevent; + InternalEvent *ievent; + AccessibleEvent *aevent; Accessible *source = cspi_object_borrow (event->source); - aevent.event.type = event->type; - aevent.event.source = source; - aevent.event.detail1 = event->detail1; - aevent.event.detail2 = event->detail2; - aevent.id = _e_id++; - aevent.magic = SPI_INTERNAL_EVENT_MAGIC; - aevent.ref_count = 0; - aevent.data = &event->any_data; + ievent = g_new0(InternalEvent, 1); + ievent->event.type = g_strdup (event->type); + ievent->event.source = source; + ievent->event.detail1 = event->detail1; + ievent->event.detail2 = event->detail2; + ievent->id = _e_id++; + ievent->magic = SPI_INTERNAL_EVENT_MAGIC; + ievent->ref_count = 0; + ievent->data = &event->any_data; + aevent = (AccessibleEvent *)ievent; + Accessible_ref (source); + AccessibleEvent_ref (aevent); /* FIXME: re-enterancy hazard on this list */ for (l = clistener->callbacks; l; l = l->next) { EventHandler *eh = l->data; /* cast hides our private stuff from client handlers */ - eh->cb.event ((AccessibleEvent *) &aevent, eh->user_data); + eh->cb.event (aevent, eh->user_data); } + AccessibleEvent_unref (aevent); cspi_object_return (source); } diff --git a/cspi/spi_event.c b/cspi/spi_event.c index feb3e71..f2d8833 100644 --- a/cspi/spi_event.c +++ b/cspi/spi_event.c @@ -704,7 +704,12 @@ AccessibleEvent_unref (const AccessibleEvent *e) { event->ref_count--; if (event->ref_count < 1) - cspi_internal_event_remove (event); + { + cspi_internal_event_remove (event); + g_free (e->type); + Accessible_unref (e->source); + g_free (e); + } } } } diff --git a/cspi/spi_streamablecontent.c b/cspi/spi_streamablecontent.c index e20ebcc..6147960 100644 --- a/cspi/spi_streamablecontent.c +++ b/cspi/spi_streamablecontent.c @@ -71,7 +71,11 @@ get_streams (void) void cspi_streams_close_all (void) { - g_hash_table_destroy (get_streams ()); + if (streams) + { + g_hash_table_destroy (streams); + streams = NULL; + } } /** -- 2.7.4