[arch-commits] Commit in gnome-2048/trunk (2 files)

Jan Steffens heftig at archlinux.org
Sun Sep 27 16:25:29 UTC 2015


    Date: Sunday, September 27, 2015 @ 18:25:29
  Author: heftig
Revision: 247543

FS#46448 crash

Added:
  gnome-2048/trunk/0001-game-Make-new_game-work-in-the-case-of-game-not-alre.patch
Modified:
  gnome-2048/trunk/PKGBUILD

-----------------------------------------------------------------+
 0001-game-Make-new_game-work-in-the-case-of-game-not-alre.patch |   55 ++++++++++
 PKGBUILD                                                        |   13 +-
 2 files changed, 65 insertions(+), 3 deletions(-)

Added: 0001-game-Make-new_game-work-in-the-case-of-game-not-alre.patch
===================================================================
--- 0001-game-Make-new_game-work-in-the-case-of-game-not-alre.patch	                        (rev 0)
+++ 0001-game-Make-new_game-work-in-the-case-of-game-not-alre.patch	2015-09-27 16:25:29 UTC (rev 247543)
@@ -0,0 +1,55 @@
+From 8a18366cb3c054f01ceef43b403cf0838937bb70 Mon Sep 17 00:00:00 2001
+From: Yanko Kaneti <yaneti at declera.com>
+Date: Sat, 26 Sep 2015 13:18:31 +0300
+Subject: [PATCH] game: Make new_game() work in the case of game not already
+ existing
+
+https://bugzilla.gnome.org/show_bug.cgi?id=755658
+---
+ src/game.vala | 20 +++++++++-----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
+
+diff --git a/src/game.vala b/src/game.vala
+index 4142223..d8673c6 100644
+--- a/src/game.vala
++++ b/src/game.vala
+@@ -107,7 +107,11 @@ public class Game : GLib.Object
+   {
+     _grid.clear ();
+     _undo_stack.clear ();
+-    _clear_foreground ();
++    // new_game could be called without an existing game
++    if (_background == null) {
++      _init_background ();
++    } else
++      _clear_foreground ();
+     score = 0;
+     _state = GameState.SHOWING_FIRST_TILE;
+     _create_random_tile ();
+@@ -148,19 +152,13 @@ public class Game : GLib.Object
+     try {
+       FileUtils.get_contents (_saved_path, out contents);
+     } catch (FileError e) {
+-      // FIXME: Returning false guarantees a crash, because _clear_foreground
+-      // will be called before _init_background(). Also, warning here makes no
+-      // sense, since restoring is expected to fail if no previously-saved game
+-      // exists. Someone needs to take a closer look at this to see what should
+-      // happen if this function needs to return false, or if it needs a return
+-      // value at all.
+-
+-      // warning ("Failed to restore game: %s", e.message);
+-      // return false;
++      return false;
+     }
+ 
+-    if (!_grid.load (contents))
++    if (!_grid.load (contents)) {
++      warning ("Failed to restore game from saved file");
+       return false;
++    }
+ 
+     lines = contents.split ("\n");
+     score = (uint)int.parse (lines[lines.length-2]);
+-- 
+2.5.3
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2015-09-27 16:18:15 UTC (rev 247542)
+++ PKGBUILD	2015-09-27 16:25:29 UTC (rev 247543)
@@ -3,7 +3,7 @@
 
 pkgname=gnome-2048
 pkgver=3.18.0
-pkgrel=1
+pkgrel=2
 pkgdesc="Obtain the 2048 tile"
 url="https://wiki.gnome.org/Apps/2048"
 arch=(x86_64 i686)
@@ -13,9 +13,16 @@
 groups=(gnome-extra)
 install=gnome-2048.install
 options=(!emptydirs)
-source=(http://ftp.gnome.org/pub/gnome/sources/$pkgname/${pkgver:0:4}/$pkgname-$pkgver.tar.xz)
-sha256sums=('87cf703f5dad02bb22ba464faa5fdf8a0784e64652de23b7f1c8685fc3d69938')
+source=(http://ftp.gnome.org/pub/gnome/sources/$pkgname/${pkgver:0:4}/$pkgname-$pkgver.tar.xz
+        '0001-game-Make-new_game-work-in-the-case-of-game-not-alre.patch')
+sha256sums=('87cf703f5dad02bb22ba464faa5fdf8a0784e64652de23b7f1c8685fc3d69938'
+            'bb9eb8e5a977828aeadb974324742c0a5b16abf2a42533db95b1a372c85b16de')
 
+prepare() {
+  cd $pkgname-$pkgver
+  patch -Np1 -i "../0001-game-Make-new_game-work-in-the-case-of-game-not-alre.patch"
+}
+
 build() {
   cd $pkgname-$pkgver
   ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var



More information about the arch-commits mailing list