[gcompris/gcomprixogoo] Shapegames could crash if one tried to move an object while the bonus-object



commit d75b609a971a3dca00818b2dc487ec286c9595bf
Author: Wolfram Sang <wolfram iswi org>
Date:   Fri Jun 19 23:45:50 2009 +0200

    Shapegames could crash if one tried to move an object while the bonus-object
     (e.g. sad flower) was still shown. Fix this by ensuring that the object to move
     or drop is the same one that got dragged.

 src/babymatch-activity/shapegame.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/babymatch-activity/shapegame.c b/src/babymatch-activity/shapegame.c
index 7ea6d2b..0ad8159 100644
--- a/src/babymatch-activity/shapegame.c
+++ b/src/babymatch-activity/shapegame.c
@@ -909,6 +909,7 @@ item_event_drag(GooCanvasItem *item,
 		GdkEvent *event, Shape *shape)
 {
   static GooCanvasItem *shadow_item = NULL;
+  static GooCanvasItem *dragged;
   double item_x, item_y;
   Shape *found_shape;
 
@@ -979,11 +980,14 @@ item_event_drag(GooCanvasItem *item,
 		       GOO_CANVAS_ITEM_INVISIBLE, NULL);
 	  gdk_pixbuf_unref(dest);
 	}
-
+      dragged = shape->item;
       gc_drag_item_move(event, NULL);
       break;
 
     case GDK_MOTION_NOTIFY:
+      if (item != dragged)
+	break;
+
       gc_drag_item_move(event, NULL);
 
       item_x = event->button.x;
@@ -1014,6 +1018,9 @@ item_event_drag(GooCanvasItem *item,
       break;
 
     case GDK_BUTTON_RELEASE:
+      if (item != dragged)
+	break;
+
       item_x = event->button.x;
       item_y = event->button.y;
       goo_canvas_convert_from_item_space(goo_canvas_item_get_canvas(item),



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