[g-a-devel] fix for removing listeners ...



Just committed this,

	HTH,

		Michael.

-- 
 michael meeks novell com  <><, Pseudo Engineer, itinerant idiot
? login-helper/Accessibility_LoginHelper-common.c
? login-helper/Accessibility_LoginHelper-imodule.c
? login-helper/Accessibility_LoginHelper-skels.c
? login-helper/Accessibility_LoginHelper-stubs.c
? login-helper/Accessibility_LoginHelper.h
? test/event-listener-test
? test/keypad-test
? test/keysynth-test
? test/login-helper-client-test
? test/login-helper-server-test
? test/screen-review-test
? test/stress-test
? test/window-listener-test
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/at-spi/ChangeLog,v
retrieving revision 1.471
diff -u -r1.471 ChangeLog
--- ChangeLog	10 May 2005 17:13:53 -0000	1.471
+++ ChangeLog	25 May 2005 10:51:16 -0000
@@ -1,3 +1,11 @@
+2005-05-25  Michael Meeks  <michael meeks novell com>
+
+	* registryd/registry.c (remove_listener_cb),
+	(impl_accessibility_registry_deregister_global_event_listener),
+	(impl_accessibility_registry_deregister_global_event_listener_all): 
+	pass a closure to the remove callback to filter listeners more
+	accurately on remove.
+
 2005-04-05  Bill Haneman <bill haneman sun com>
 
 	* configure.in: Revved to 1.6.4.
Index: registryd/registry.c
===================================================================
RCS file: /cvs/gnome/at-spi/registryd/registry.c,v
retrieving revision 1.67
diff -u -r1.67 registry.c
--- registryd/registry.c	30 Jan 2004 17:47:16 -0000	1.67
+++ registryd/registry.c	25 May 2005 10:51:17 -0000
@@ -423,20 +423,30 @@
     }
 }
 
+typedef struct {
+  gboolean                    remove_all;
+  Accessibility_EventListener listener;
+  EventTypeStruct             etype;
+} RemoveListenerClosure;
+
 static SpiReEntrantContinue
 remove_listener_cb (GList * const *list, gpointer user_data)
 {
   SpiListenerStruct *ls = (SpiListenerStruct *) (*list)->data;
   CORBA_Environment  ev;
-  Accessibility_EventListener listener = user_data;
+  RemoveListenerClosure *cl = user_data;
 
   CORBA_exception_init (&ev);
-	
-  if (CORBA_Object_is_equivalent (ls->listener, listener, &ev))
-    {
-       spi_re_entrant_list_delete_link (list);
-       spi_listener_struct_free (ls, &ev);
-    }
+
+  if (cl->remove_all || (cl->etype.minor == ls->event_type_quark &&
+			 cl->etype.type_cat == ls->event_type_cat ) )
+  {
+    if (CORBA_Object_is_equivalent (ls->listener, cl->listener, &ev))
+      {
+        spi_re_entrant_list_delete_link (list);
+        spi_listener_struct_free (ls, &ev);
+      }
+  }
 
   CORBA_exception_free (&ev);
 
@@ -455,14 +465,18 @@
   int i;
   GList **lists[3];
   SpiRegistry *registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
+  RemoveListenerClosure cl = { 0, };
 
   lists[0] = &registry->object_listeners;
   lists[1] = &registry->window_listeners;
   lists[2] = &registry->toolkit_listeners;
 
+  cl.remove_all = TRUE;
+  cl.listener = listener;
+
   for (i = 0; i < sizeof (lists) / sizeof (lists[0]); i++)
     {
-      spi_re_entrant_list_foreach (lists [i], remove_listener_cb, listener);
+      spi_re_entrant_list_foreach (lists [i], remove_listener_cb, &cl);
     }
 }
 
@@ -478,14 +492,16 @@
 	CORBA_Environment          *ev)
 {
   SpiRegistry    *registry;
-  EventTypeStruct etype;
+  RemoveListenerClosure cl = { 0, };
 
   registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
 
-  parse_event_type (&etype, (char *) event_name);
+  cl.remove_all = FALSE;
+  parse_event_type (&cl.etype, (char *) event_name);
+  cl.listener = listener;
 
-  spi_re_entrant_list_foreach (get_listener_list (registry, etype.type_cat),
-				remove_listener_cb, listener);
+  spi_re_entrant_list_foreach (get_listener_list (registry, cl.etype.type_cat),
+				remove_listener_cb, &cl);
 }
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]