[gcompris/gcomprixo] 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/gcomprixo] Shapegames could crash if one tried to move an object while the bonus-object
- Date: Fri, 19 Jun 2009 18:42:29 -0400 (EDT)
commit abb7a241a950b5419bfc41e32a9edc43aaabec12
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 | 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]