[gcompris/GCOMPRIS_8_3] Shapegames could crash if one tried to move an object while the bonus-object
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: svn-commits-list gnome org
- Subject: [gcompris/GCOMPRIS_8_3] Shapegames could crash if one tried to move an object while the bonus-object
- Date: Fri, 19 Jun 2009 15:59:38 -0400 (EDT)
commit 44ddd5e0419d61625f014fc0bc128d7227ff5d0a
Author: Wolfram Sang <wolfram iswi org>
Date: Fri Jun 19 00:17: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/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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]