[maemo-commits] [maemo-commits] r18072 - in projects/haf/trunk/clutter0.8: clutter debian

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Apr 15 17:16:47 EEST 2009
Author: gw
Date: 2009-04-15 17:16:45 +0300 (Wed, 15 Apr 2009)
New Revision: 18072

Modified:
   projects/haf/trunk/clutter0.8/clutter/clutter-actor.c
   projects/haf/trunk/clutter0.8/clutter/clutter-event.c
   projects/haf/trunk/clutter0.8/clutter/clutter-event.h
   projects/haf/trunk/clutter0.8/debian/changelog
Log:
  * clutter-actor.c, clutter-event.c, clutter-event.h: Fix for NB#110783, we 
    now remove any events from the event queue that have their source set to 
    any actor that is disposed of.



Modified: projects/haf/trunk/clutter0.8/clutter/clutter-actor.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/clutter-actor.c	2009-04-15 12:33:07 UTC (rev 18071)
+++ projects/haf/trunk/clutter0.8/clutter/clutter-actor.c	2009-04-15 14:16:45 UTC (rev 18072)
@@ -1923,6 +1923,10 @@
   g_signal_emit (self, actor_signals[DESTROY], 0);
 
   G_OBJECT_CLASS (clutter_actor_parent_class)->dispose (object);
+  /* Remove ourselves from the event list if we happened to have been put
+   * in it. We only use the pointer here so it doesn't matter that the
+   * object has been disposed of. */
+  clutter_event_remove_source( self );
 }
 
 static void

Modified: projects/haf/trunk/clutter0.8/clutter/clutter-event.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/clutter-event.c	2009-04-15 12:33:07 UTC (rev 18071)
+++ projects/haf/trunk/clutter0.8/clutter/clutter-event.c	2009-04-15 14:16:45 UTC (rev 18072)
@@ -273,11 +273,11 @@
 
 /**
  * clutter_keysym_to_unicode:
- * @keyval: a clutter key symbol 
- * 
+ * @keyval: a clutter key symbol
+ *
  * Convert from a Clutter key symbol to the corresponding ISO10646 (Unicode)
  * character.
- * 
+ *
  * Return value: the corresponding unicode character, or 0 if there
  *               is no corresponding character.
  **/
@@ -310,17 +310,17 @@
       return clutter_keysym_to_unicode_tab[mid].ucs;
     }
   }
- 
+
   /* No matching Unicode value found */
   return 0;
 }
 
 /**
  * clutter_event_get_device_id:
- * @event: a clutter event 
- * 
+ * @event: a clutter event
+ *
  * Retrieves the events device id if set.
- * 
+ *
  * Return value: A unique identifier for the device or -1 if the event has
  *               no specific device set.
  **/
@@ -448,9 +448,42 @@
 }
 
 /**
+ * clutter_event_remove_source:
+ * @actor: A #ClutterActor.
+ *
+ * Removes and frees all events in the queue that contain a source that
+ * is the given clutter actor.
+ */
+void
+clutter_event_remove_source  (ClutterActor       *actor)
+{
+  ClutterMainContext *context = clutter_context_get_default ();
+  GList *l;
+
+  if (!context->events_queue)
+    return;
+
+  l = context->events_queue->head;
+  while (l)
+    {
+      GList *nextl = l->next;
+      ClutterEvent *event = (ClutterEvent*)l->data;
+      /* if this event's source is this actor, remove it from the queue */
+      if (event->any.source == actor)
+        {
+          g_queue_remove(context->events_queue, l->data);
+          clutter_event_free(event);
+        }
+      /* We're safe to carry on here because we saved our last
+       * 'next' pointer before removing this one */
+      l = nextl;
+    }
+}
+
+/**
  * clutter_event_get:
  *
- * Pops an event off the event queue. Applications should not need to call 
+ * Pops an event off the event queue. Applications should not need to call
  * this.
  *
  * Return value: A #ClutterEvent or NULL if queue empty
@@ -473,10 +506,10 @@
 
 /**
  * clutter_event_peek:
- * 
- * Returns a pointer to the first event from the event queue but 
- * does not remove it. 
  *
+ * Returns a pointer to the first event from the event queue but
+ * does not remove it.
+ *
  * Return value: A #ClutterEvent or NULL if queue empty.
  *
  * Since: 0.4
@@ -487,7 +520,7 @@
   ClutterMainContext *context = clutter_context_get_default ();
 
   g_return_val_if_fail (context != NULL, NULL);
-  
+
   if (context->events_queue == NULL)
     return NULL;
 

Modified: projects/haf/trunk/clutter0.8/clutter/clutter-event.h
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/clutter-event.h	2009-04-15 12:33:07 UTC (rev 18071)
+++ projects/haf/trunk/clutter0.8/clutter/clutter-event.h	2009-04-15 14:16:45 UTC (rev 18072)
@@ -117,7 +117,7 @@
  *
  * Since: 0.4
  */
-typedef enum 
+typedef enum
 {
   CLUTTER_NOTHING = 0,
   CLUTTER_KEY_PRESS,
@@ -422,6 +422,7 @@
 ClutterEvent *      clutter_event_new           (ClutterEventType    type);
 ClutterEvent *      clutter_event_copy          (ClutterEvent       *event);
 void                clutter_event_free          (ClutterEvent       *event);
+void                clutter_event_remove_source (ClutterActor       *actor);
 ClutterEventType    clutter_event_type          (ClutterEvent       *event);
 guint32             clutter_event_get_time      (ClutterEvent       *event);
 ClutterModifierType clutter_event_get_state     (ClutterEvent       *event);

Modified: projects/haf/trunk/clutter0.8/debian/changelog
===================================================================
--- projects/haf/trunk/clutter0.8/debian/changelog	2009-04-15 12:33:07 UTC (rev 18071)
+++ projects/haf/trunk/clutter0.8/debian/changelog	2009-04-15 14:16:45 UTC (rev 18072)
@@ -1,3 +1,11 @@
+clutter (0.8.2-0maemo27~unreleased) unstable; urgency=low
+
+  * clutter-actor.c, clutter-event.c, clutter-event.h: Fix for NB#110783, we 
+    now remove any events from the event queue that have their source set to 
+    any actor that is disposed of.
+
+ -- Gordon Williams <gordon.williams at collabora.co.uk>  Wed, 15 Apr 2009 15:09:00 +0000
+
 clutter (0.8.2-0maemo26) unstable; urgency=low
 
   * Disable compilation of Glib debug messages.


More information about the maemo-commits mailing list