gnome-games r9000 - in trunk/glchess/src/lib: chess scene/cairo scene/opengl



Author: rancell
Date: Mon Apr  6 00:24:42 2009
New Revision: 9000
URL: http://svn.gnome.org/viewvc/gnome-games?rev=9000&view=rev

Log:
Fix crash when undoing a pawn promotion (Chris Ball, Bug #577395)


Modified:
   trunk/glchess/src/lib/chess/board.py
   trunk/glchess/src/lib/scene/cairo/__init__.py
   trunk/glchess/src/lib/scene/opengl/opengl.py

Modified: trunk/glchess/src/lib/chess/board.py
==============================================================================
--- trunk/glchess/src/lib/chess/board.py	(original)
+++ trunk/glchess/src/lib/chess/board.py	Mon Apr  6 00:24:42 2009
@@ -793,7 +793,7 @@
         
         'piece' is the piece being moved.
         'start' is the start location of the piece (tuple (file,rank) or None if the piece is being created.
-        'end' is the end location of the piece (tuple (file,rank)
+        'end' is the end location of the piece (tuple (file,rank))
         'delete' is a flag to show if the piece should be deleted when it arrives there (boolean).
         """
         pass

Modified: trunk/glchess/src/lib/scene/cairo/__init__.py
==============================================================================
--- trunk/glchess/src/lib/scene/cairo/__init__.py	(original)
+++ trunk/glchess/src/lib/scene/cairo/__init__.py	Mon Apr  6 00:24:42 2009
@@ -60,6 +60,11 @@
 
     def move(self, coord, delete, animate = True):
         """Extends glchess.scene.ChessPiece"""
+        if not coord:
+            self.scene.pieces.remove(self)
+            self.feedback.onDeleted()
+            return
+        
         self.coord = coord
         self.delete = delete
         self.targetPos = self.__coordToLocation(coord)

Modified: trunk/glchess/src/lib/scene/opengl/opengl.py
==============================================================================
--- trunk/glchess/src/lib/scene/opengl/opengl.py	(original)
+++ trunk/glchess/src/lib/scene/opengl/opengl.py	Mon Apr  6 00:24:42 2009
@@ -109,6 +109,11 @@
 
     def move(self, coord, delete, animate = True):
         """Extends glchess.scene.ChessPiece"""
+        if not coord:
+            self.scene.pieces.remove(self)
+            self.feedback.onDeleted()
+            return
+
         self.delete = delete
         self.location = coord
         self.targetPos = self.scene._coordToLocation(coord)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]