Re: [g-a-devel]Changes for at-poke
- From: "Padraig O'Briain" <Padraig Obriain Sun COM>
- To: michael ximian com
- Cc: gnome-accessibility-devel gnome org
- Subject: Re: [g-a-devel]Changes for at-poke
- Date: Wed, 18 Sep 2002 13:09:25 +0100 (BST)
Michael,
Thanks. I had not read ypour previous mail carefully enough.
I have attached the updated changes for child-listener.c
Padraig
>
>
> Hi Padraig,
>
> On Wed, 2002-09-18 at 09:07, Padraig O'Briain wrote:
> > I have reworked the patch.
>
> ... you're still doing an unsafe loop destroy: ...
>
> > + if (is_remove) {
> > + for (l = cl->roots; l; l = l->next) {
> > + if (l->data == accessible) {
> > + g_signal_emit (cl, signals [ROOT_DIED],
0, l->data);
> > + Accessible_unref (l->data);
> > + cl->roots = g_slist_delete_link
(cl->roots, l);
> > + }
> > + }
>
> See my spiel on the 'next' pointer being invalid, you need a 'next'
> intermediate;
>
> Regards,
>
> Michael.
>
> --
> mmeeks gnu org <><, Pseudo Engineer, itinerant idiot
>
> _______________________________________________
> Gnome-accessibility-devel mailing list
> Gnome-accessibility-devel gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-accessibility-devel
Index: child-listener.c
===================================================================
RCS file: /cvs/gnome/at-poke/src/child-listener.c,v
retrieving revision 1.3
diff -u -p -r1.3 child-listener.c
--- child-listener.c 21 Mar 2002 21:46:59 -0000 1.3
+++ child-listener.c 18 Sep 2002 12:06:47 -0000
@@ -19,9 +19,12 @@ enum {
static guint signals [LAST_SIGNAL];
static GObjectClass *parent_class;
+static ChildListener *listener = NULL;
GType child_listener_get_type (void);
+extern Accessible *get_accessible_at_index (GtkListStore *list_store, int i);
+
GNOME_CLASS_BOILERPLATE (ChildListener,
child_listener,
GObject,
@@ -35,28 +38,27 @@ child_listener_global_event (const Acces
if (event->source == cl->desktop) {
GSList *l;
- GSList *copy = NULL;
-
+ gboolean is_remove;
+ Accessible *accessible;
+ GSList *next;
+
+ is_remove = g_strstr_len (event->type, -1, "remove") != NULL;
+ if (is_remove)
+ accessible = get_accessible_at_index (cl->list_store, event->detail1);
g_signal_emit (
cl, signals [APP_LIST_CHANGED], 0);
- for (l = cl->roots; l; l = l->next) {
- copy = g_slist_prepend (copy, l->data);
- Accessible_ref (l->data);
+ if (is_remove) {
+ for (l = cl->roots; l; l = next) {
+ next = l->next;
+ if (l->data == accessible) {
+
+ g_signal_emit (cl, signals [ROOT_DIED], 0, l->data);
+ Accessible_unref (l->data);
+ cl->roots = g_slist_delete_link (cl->roots, l);
+ }
+ }
}
-
- for (l = copy; l; l = l->next) {
- char *txt;
-
- if (!(txt = Accessible_getName (l->data)))
- g_signal_emit (cl, signals [ROOT_DIED], 0, l->data);
- else
- SPI_freeString (txt);
- }
-
- for (l = cl->roots; l; l = l->next)
- Accessible_unref (l->data);
- g_slist_free (copy);
} else
g_signal_emit (cl, signals [CHILDREN_CHANGED], 0, event->source);
}
@@ -132,14 +134,21 @@ child_listener_class_init (ChildListener
}
ChildListener *
-child_listener_get (void)
+child_listener_create (GtkListStore *list_store)
{
- static ChildListener *listener = NULL;
-
- if (!listener)
+ if (!listener) {
listener = g_object_new (
- child_listener_get_type (), NULL);
+ child_listener_get_type (), NULL);
+ listener->list_store = list_store;
+ } else {
+ g_warning ("ChildListener already created");
+ }
+ return listener;
+}
+ChildListener *
+child_listener_get (void)
+{
return listener;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]