Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/boards
diff options
context:
space:
mode:
authorWolfram Sang <wolfram@iswi.org>2009-06-18 22:17:50 (GMT)
committer Bruno Coudoin <bruno.coudoin@free.fr>2009-06-18 22:17:50 (GMT)
commitc2532a22ab13b670ecf04dff570c22f4eb165164 (patch)
tree73e65082cd4f7dc6d62a38cb57ab8d175a414475 /src/boards
parentdd1080968158f6d1e661d5ef1951c10f59caa51e (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.
Diffstat (limited to 'src/boards')
-rw-r--r--src/boards/shapegame.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/boards/shapegame.c b/src/boards/shapegame.c
index 41d394b..6267a7f 100644
--- a/src/boards/shapegame.c
+++ b/src/boards/shapegame.c
@@ -927,6 +927,7 @@ void target_point_hide()
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;
@@ -1005,11 +1006,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;
@@ -1034,6 +1039,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);