[banshee/f14/master] - Fix crash under KDE on x86_64 systems (BZ 664636)

chkr chkr at fedoraproject.org
Sun Jan 2 20:21:35 UTC 2011


commit ec754cc44560a10ca8f5fa4eabcfb6906f540235
Author: Christian Krause <chkr at fedoraproject.org>
Date:   Sun Jan 2 21:21:14 2011 +0100

    - Fix crash under KDE on x86_64 systems (BZ 664636)

 0001-enhance-check-for-RGBA-visual.patch |   95 ++++++++++++++++++++++++++++++
 banshee.spec                             |   19 ++++--
 2 files changed, 108 insertions(+), 6 deletions(-)
---
diff --git a/0001-enhance-check-for-RGBA-visual.patch b/0001-enhance-check-for-RGBA-visual.patch
new file mode 100644
index 0000000..fc88c14
--- /dev/null
+++ b/0001-enhance-check-for-RGBA-visual.patch
@@ -0,0 +1,95 @@
+From 7e5ab2acd990a390f1d9b57ecfebe0722463cebc Mon Sep 17 00:00:00 2001
+From: Christian Krause <chkr at plauener.de>
+Date: Sun, 2 Jan 2011 01:43:29 +0100
+Subject: [PATCH] enhance check for RGBA visual
+
+compare the sum of the precisions of all colors with the
+depth of the visual (if gtk+ >= 2.22 is available)
+---
+ build/m4/banshee/libbanshee.m4                     |    1 +
+ .../X11NotificationArea.cs                         |   34 +++++++++++++++++--
+ .../Banshee.NotificationArea/Makefile.am           |    4 ++
+ 3 files changed, 35 insertions(+), 4 deletions(-)
+
+diff --git a/build/m4/banshee/libbanshee.m4 b/build/m4/banshee/libbanshee.m4
+index 9c9da10..16f7f07 100644
+--- a/build/m4/banshee/libbanshee.m4
++++ b/build/m4/banshee/libbanshee.m4
+@@ -40,6 +40,7 @@ AC_DEFUN([BANSHEE_CHECK_LIBBANSHEE],
+ 	AM_CONDITIONAL(HAVE_X11, test "x$GRAPHICS_SUBSYSTEM" = "xX11")
+ 	AM_CONDITIONAL(HAVE_QUARTZ, test "x$GRAPHICS_SUBSYSTEM" = "xQuartz")
+ 	AM_CONDITIONAL(HAVE_CLUTTER, test "x$enable_clutter" = "xyes")
++	AM_CONDITIONAL(HAVE_GTK_2_22, pkg-config --atleast-version=2.22 gtk+-2.0)
+ 
+ 	AC_SUBST(GRAPHICS_SUBSYSTEM)
+ 	AC_SUBST(LIBBANSHEE_CFLAGS)
+diff --git a/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationArea.cs b/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationArea.cs
+index cf13447..e1428b3 100644
+--- a/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationArea.cs
++++ b/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationArea.cs
+@@ -421,10 +421,22 @@ public class X11NotificationArea : Plug
+             visual = GLib.Object.GetObject (raw_ret) as Gdk.Visual;
+         }
+ 
+-        // TODO the proper check is (visual->red_prec + visual->blue_prec + visual->green_prec < visual->depth)
+-        // but this seems to work
+-        visual_is_rgba = visual != null && visual == Screen.RgbaVisual;
+-
++#if HAVE_GTK_2_22
++	IntPtr r_mask, r_shift, r_precision;
++	IntPtr g_mask, g_shift, g_precision;
++	IntPtr b_mask, b_shift, b_precision;
++
++	if (visual == null) {
++		visual_is_rgba = false;
++	} else {
++		gdk_visual_get_red_pixel_details(visual.Handle, out r_mask, out r_shift, out  r_precision);
++		gdk_visual_get_green_pixel_details(visual.Handle, out g_mask, out g_shift, out  g_precision);
++		gdk_visual_get_blue_pixel_details(visual.Handle, out b_mask, out b_shift, out  b_precision);
++		visual_is_rgba = ((int)r_precision + (int)g_precision + (int)b_precision) < gdk_visual_get_depth(visual.Handle);
++	}
++#else
++	visual_is_rgba = visual != null && visual == Screen.RgbaVisual;
++#endif
+         // we can't be double-buffered when we aren't using a real RGBA visual
+         DoubleBuffered = visual_is_rgba;
+ 
+@@ -433,6 +445,20 @@ public class X11NotificationArea : Plug
+         }
+     }
+ 
++#if HAVE_GTK_2_22
++    [DllImport ("libgdk-x11-2.0.so.0")]
++    private static extern int gdk_visual_get_depth(IntPtr visual);
++
++    [DllImport ("libgdk-x11-2.0.so.0")]
++    private static extern void gdk_visual_get_red_pixel_details(IntPtr visual, out IntPtr mask, out IntPtr shift, out IntPtr precision);
++
++    [DllImport ("libgdk-x11-2.0.so.0")]
++    private static extern void gdk_visual_get_green_pixel_details(IntPtr visual, out IntPtr mask, out IntPtr shift, out IntPtr precision);
++
++    [DllImport ("libgdk-x11-2.0.so.0")]
++    private static extern void gdk_visual_get_blue_pixel_details(IntPtr visual, out IntPtr mask, out IntPtr shift, out IntPtr precision);
++#endif
++
+     [DllImport ("libgdk-x11-2.0.so.0")]
+     private static extern IntPtr gdk_x11_screen_lookup_visual (IntPtr screen, int visual_id);
+ 
+diff --git a/src/Extensions/Banshee.NotificationArea/Makefile.am b/src/Extensions/Banshee.NotificationArea/Makefile.am
+index 819e587..41de66c 100644
+--- a/src/Extensions/Banshee.NotificationArea/Makefile.am
++++ b/src/Extensions/Banshee.NotificationArea/Makefile.am
+@@ -5,6 +5,10 @@ GMCS_FLAGS+="-define:INTERNAL_NOTIFY_SHARP"
+ NOTIFY_SHARP_LIBS = 
+ endif
+ 
++if HAVE_GTK_2_22
++GMCS_FLAGS+= "-define:HAVE_GTK_2_22"
++endif
++
+ ASSEMBLY = Banshee.NotificationArea
+ TARGET = library
+ LINK = $(REF_EXTENSION_NOTIFICATIONAREA) $(NOTIFY_SHARP_LIBS)
+-- 
+1.7.2.3
+
diff --git a/banshee.spec b/banshee.spec
index 4497278..d1c0bc7 100644
--- a/banshee.spec
+++ b/banshee.spec
@@ -7,7 +7,7 @@
 Name:    banshee
 Version: %{mainver}%{?patchver}
 #Release: 0.1.%{gitdate}git%{?dist}
-Release: 10%{?dist}
+Release: 10%{?dist}.1
 Summary: Easily import, manage, and play selections from your music collection
 
 Group:   Applications/Multimedia
@@ -22,12 +22,15 @@ Source1: README.Fedora
 #Source2: %{name}-make-git-snapshot.sh
 
 # for snapshots only: don't run configure at the end of autogen.sh
-#Patch0:  %{name}-noconf.patch
+# currently needed for Patch4
+Patch0:  %{name}-noconf.patch
 
 # https://bugzilla.gnome.org/show_bug.cgi?id=625264
 Patch1: banshee-1.7.6-no-update-desktop-database.patch
 Patch2: banshee-1.8.0-fix-apple-sync-screen.patch
 Patch3: banshee-1.8.0-CVE-2010-3998.patch
+# https://bugzilla.gnome.org/show_bug.cgi?id=638477
+Patch4: 0001-enhance-check-for-RGBA-visual.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -148,17 +151,18 @@ developing applications that use %{name}-musicbrainz.
 %prep
 %setup -q -n %{name}-1-%{version}
 #%setup -q -n %{name}-%{gitdate}
-# Snapshots only
-#%patch0 -p1 -b .noconf
+# Snapshots only, but currently needed for patch4
+%patch0 -p1 -b .noconf
 cp -p %{SOURCE1} .
 %patch1 -p1 -b .no-update-desktop-database
 %patch2 -p1 -b .fix-apple-sync-screen
 %patch3 -p1 -b .CVE-2010-3998
+%patch4 -p1 -b .rgba_check
 
 %build
 export MONO_SHARED_DIR=%mono_shared
-# Snapshots only
-#./autogen.sh
+# Snapshots only, but currently needed for patch4
+./autogen.sh
 
 # Please note that "--disable-ipod" does not actually remove
 # ipod support, it just removes the ipod-sharp library dependency.
@@ -247,6 +251,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 
 
 %changelog
+* Sun Jan 02 2011 Christian Krause <chkr at fedoraproject.org> - 1.8.0-10.1
+- Fix crash under KDE on x86_64 systems (BZ 664636)
+
 * Mon Oct 25 2010 Nathaniel McCallum <nathaniel at natemccallum.com> - 1.8.0-10
 - Add a patch to fix CVE-2010-3998
 


More information about the scm-commits mailing list