Fixed memory leak in registry mouse support.
authorbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Fri, 13 Sep 2002 13:13:40 +0000 (13:13 +0000)
committerbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Fri, 13 Sep 2002 13:13:40 +0000 (13:13 +0000)
Removed redundant listeners in event-listener-test.

git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@343 e2bd861d-eb25-0410-b326-f6ed22b6b98c

ChangeLog
registryd/deviceeventcontroller.c
test/event-listener-test.c

index b6d5bd9..425cb85 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2002-09-13  Bill Haneman <bill.haneman@sun.com>
+
+       * registryd/deviceeventcontroller.c:
+       spi_dec_mouse_moved: Fixed memory leaks and reordered 2 code blocks.
+
+       * test/event-listener-test.c:
+       main: commented out three redundant listeners, to reduce output
+       noise. (They still are potentially useful for testing).
+       
+
 2002-09-13  Michael Meeks  <michael@ximian.com>
 
        * Update all the copyrights to include Ximian.
index 58cc616..fc0c535 100644 (file)
@@ -162,19 +162,13 @@ spi_dec_poll_mouse_moved (gpointer data)
   unsigned int mask_return;
   gchar event_name[24];
   Display *display = spi_get_display ();
-  if (last_mouse_pos == NULL) {
-         last_mouse_pos = g_new0 (GdkPoint, 1);
-         last_mouse_pos->x = 0;
-         last_mouse_pos->y = 0;
-         e.type = g_strdup ("mouse:abs");
-  } else {
-         e.type = g_strdup ("mouse:rel");
-  }
+
   if (display != NULL)
          XQueryPointer(display, DefaultRootWindow (display),
                &root_return, &child_return,
                &x, &y,
                &win_x_return, &win_y_return, &mask_return);
+
   if ((mask_return & mouse_button_mask) != mouse_button_state) {
          int button_number = 0;
          if (!(mask_return & Button1Mask) &&
@@ -207,23 +201,32 @@ spi_dec_poll_mouse_moved (gpointer data)
                  Accessibility_Registry_notifyEvent (BONOBO_OBJREF (registry),
                                                      &e,
                                                      &ev);
+                 g_free (e.type);
          }
          mouse_button_state = mask_return & mouse_button_mask;
   }
+  if (last_mouse_pos == NULL) {
+         last_mouse_pos = g_new0 (GdkPoint, 1);
+         last_mouse_pos->x = 0;
+         last_mouse_pos->y = 0;
+         e.type = g_strdup ("mouse:abs");
+  } else {
+         e.type = g_strdup ("mouse:rel");  
+  }
   if (x != last_mouse_pos->x || y != last_mouse_pos->y) {
          e.source = BONOBO_OBJREF (registry->desktop);
          e.detail1 = x - last_mouse_pos->x;
          e.detail2 = y - last_mouse_pos->y;
          CORBA_exception_init (&ev);
-         if (last_mouse_pos == NULL)
-                 last_mouse_pos = g_new0 (GdkPoint, 1);
          last_mouse_pos->x = x;
          last_mouse_pos->y = y;
          Accessibility_Registry_notifyEvent (BONOBO_OBJREF (registry),
                                              &e,
                                              &ev);
+         g_free (e.type);
          return TRUE;
   }
+  g_free (e.type);
   return FALSE;
 }
 
index 5242041..61c7cd2 100644 (file)
@@ -99,18 +99,18 @@ main (int argc, char **argv)
   }
   SPI_registerGlobalEventListener (generic_listener,
                                   "object:property-change");
-  SPI_registerGlobalEventListener (specific_listener,
-                                  "object:property-change:accessible-name");
+/*  SPI_registerGlobalEventListener (specific_listener,
+    "object:property-change:accessible-name");*/
   SPI_registerGlobalEventListener (generic_listener,
                                   "object:state-changed"); 
-  SPI_registerGlobalEventListener (specific_listener,
-                                  "object:state-changed:focused"); 
+/*  SPI_registerGlobalEventListener (specific_listener,
+    "object:state-changed:focused"); */
   SPI_registerGlobalEventListener (generic_listener,
                                   "object:selection-changed"); 
   SPI_registerGlobalEventListener (generic_listener,
                                   "object:children-changed"); 
-  SPI_registerGlobalEventListener (specific_listener,
-                                  "object:children-changed:add"); 
+/*  SPI_registerGlobalEventListener (specific_listener,
+    "object:children-changed:add"); */
   SPI_registerGlobalEventListener (generic_listener,
                                   "object:visible-data-changed"); 
   SPI_registerGlobalEventListener (generic_listener,