diff options
author | Wolfram Sang <wolfram@iswi.org> | 2009-06-19 21:45:50 (GMT) |
---|---|---|
committer | Bruno Coudoin <bruno.coudoin@free.fr> | 2009-06-19 22:41:06 (GMT) |
commit | abb7a241a950b5419bfc41e32a9edc43aaabec12 (patch) | |
tree | 0b9df3cfbf293e0e5a98e4ca5d2ad02a04e3e00f | |
parent | 540a3faa1637c080f8d0030b70ac5aaf32da211f (diff) |
Shapegames could crash if one tried to move an object while the bonus-objectgcomprixo
(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.
-rw-r--r-- | src/babymatch-activity/shapegame.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/babymatch-activity/shapegame.c b/src/babymatch-activity/shapegame.c index 92ede9b..ce6cee6 100644 --- a/src/babymatch-activity/shapegame.c +++ b/src/babymatch-activity/shapegame.c @@ -923,6 +923,7 @@ void target_point_switch_on(Shape *shape_on) static gint item_event_drag(GnomeCanvasItem *item, GdkEvent *event, gpointer data) { static GnomeCanvasItem *shadow_item=NULL; + static GnomeCanvasItem *dragged; double item_x, item_y; Shape *shape, *found_shape; @@ -994,11 +995,14 @@ static gint item_event_drag(GnomeCanvasItem *item, GdkEvent *event, gpointer dat gdk_pixbuf_unref(dest); gdk_pixbuf_unref(pixmap); } + dragged = shape->item; gnome_canvas_item_reparent(shape->item, GNOME_CANVAS_GROUP(shape_list_root_item->parent)); gnome_canvas_item_raise_to_top(shape->item); gc_drag_item_move(event); break; case GDK_MOTION_NOTIFY: + if (item != dragged) + break; gc_drag_item_move(event); item_x = event->button.x; @@ -1023,6 +1027,8 @@ static gint item_event_drag(GnomeCanvasItem *item, GdkEvent *event, gpointer dat target_point_switch_on(found_shape); break; case GDK_BUTTON_RELEASE: + if (item != dragged) + break; item_x = event->button.x; item_y = event->button.y; gnome_canvas_item_w2i(item->parent, &item_x, &item_y); |