diff options
author | Wolfram Sang <wolfram@iswi.org> | 2009-06-18 22:17:50 (GMT) |
---|---|---|
committer | Bruno Coudoin <bruno.coudoin@free.fr> | 2009-06-19 19:44:10 (GMT) |
commit | 44ddd5e0419d61625f014fc0bc128d7227ff5d0a (patch) | |
tree | 21ec2e278720bd4ea267cafbdfee6cbdd5a520c1 | |
parent | 622c0d150ee5a9529d39b2e1742b8167e3f059ef (diff) |
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.
-rw-r--r-- | src/boards/shapegame.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/boards/shapegame.c b/src/boards/shapegame.c index b2dc781..41f1b5c 100644 --- a/src/boards/shapegame.c +++ b/src/boards/shapegame.c @@ -922,6 +922,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; @@ -999,11 +1000,15 @@ 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; @@ -1028,6 +1033,9 @@ 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); |