yaneti pushed to gnome-2048 (master). "Apply upstream patch for bug 1208841 (..more)"

notifications at fedoraproject.org notifications at fedoraproject.org
Fri Apr 3 11:56:55 UTC 2015


>From ec51343794ce046bb21dad25890d367d6979e28a Mon Sep 17 00:00:00 2001
From: Yanko Kaneti <yaneti at declera.com>
Date: Fri, 3 Apr 2015 14:53:40 +0300
Subject: Apply upstream patch for bug 1208841

Backport rather than pick a recet checkout because upstream
depends on libgames-support which is not yet packaged

diff --git a/0001-Fix-crash-due-to-not-available-colors.patch b/0001-Fix-crash-due-to-not-available-colors.patch
new file mode 100644
index 0000000..382bac1
--- /dev/null
+++ b/0001-Fix-crash-due-to-not-available-colors.patch
@@ -0,0 +1,48 @@
+From 445d6769678a6ea01c4d1395812d586a782d39f7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Juan=20R=2E=20Garc=C3=ADa=20Blanco?= <juanrgar at gmail.com>
+Date: Sun, 15 Feb 2015 22:22:07 +0100
+Subject: [PATCH] Fix crash due to not available colors
+
+Tiles up to 2048 are assigned colors, while tiles greater than that are
+not. The program crashed when such a tile needed to be displayed.
+
+A very simple algorithm has been added to deterministically generate
+colors based on the tile value and a pre-defined set of colors.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=743119
+---
+ src/view.vala | 19 ++++++++++++++++++-
+ 1 file changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/src/view.vala b/src/view.vala
+index 3d0428d..aef124e 100644
+--- a/src/view.vala
++++ b/src/view.vala
+@@ -177,6 +177,23 @@ public class ColorPalette : GLib.Object
+ 
+   public Clutter.Color pick_color (uint val)
+   {
+-    return _palette.get (val);
++    Clutter.Color color;
++
++    if (_palette.has_key (val)) {
++      color = _palette.get (val);
++    } else {
++      uint norm_val;
++      uint8 sbits;
++
++      norm_val = val / 2048;
++      color = _palette.get (norm_val);
++
++      sbits = (uint8)(val % 7);
++      color.red <<= sbits;
++      color.green <<= sbits;
++      color.blue <<= sbits;
++    }
++
++    return color;
+   }
+ }
+-- 
+2.3.4
+
diff --git a/gnome-2048.spec b/gnome-2048.spec
index f75ada2..c7f4384 100644
--- a/gnome-2048.spec
+++ b/gnome-2048.spec
@@ -3,7 +3,7 @@
 
 Name:           gnome-2048
 Version:        0.1.0
-Release:        0.1.git%{gitrev}%{?dist}
+Release:        0.2.git%{gitrev}%{?dist}
 Summary:        A 2048 clone for GNOME
 
 License:        GPLv3+
@@ -14,6 +14,9 @@ URL:            https://wiki.gnome.org/Apps/2048
 # git archive --format=tar --prefix gnome-2048-0.1.0-%{gitrev}/ HEAD | xz >  ../gnome-2048-0.1.0-%{gitrev}.tar.xz
 Source0:        gnome-2048-0.1.0-%{gitrev}.tar.xz
 
+# Upstream fix for https://bugzilla.gnome.org/show_bug.cgi?id=743119
+Patch1:         0001-Fix-crash-due-to-not-available-colors.patch
+
 BuildRequires:  pkgconfig(gtk+-3.0)
 BuildRequires:  pkgconfig(clutter-1.0)
 BuildRequires:  pkgconfig(clutter-gtk-1.0)
@@ -31,6 +34,7 @@ http://en.wikipedia.org/wiki/2048_(video_game)
 
 %prep
 %setup -q -n %{name}-%{version}-%{gitrev}
+%patch1 -p1 -b .colorcrash
 
 
 %build
@@ -78,5 +82,8 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
 
 
 %changelog
+* Fri Apr  3 2015 Yanko Kaneti <yaneti at declera.com> - 0.1.0-0.2.83c5a4a
+- Apply upstream patch for bug 1208841
+
 * Wed Jan 14 2015 Yanko Kaneti <yaneti at declera.com> - 0.1.0-0.1.83c5a4a
 - Packaging attempt
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/gnome-2048.git/commit/?h=master&id=ec51343794ce046bb21dad25890d367d6979e28a


More information about the scm-commits mailing list