rpms/gnome-panel/F-12 panel-randr-crashes.patch, NONE, 1.1 gnome-panel.spec, 1.372, 1.373

Matthias Clasen mclasen at fedoraproject.org
Thu Oct 8 17:56:47 UTC 2009


Author: mclasen

Update of /cvs/pkgs/rpms/gnome-panel/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv20955

Modified Files:
	gnome-panel.spec 
Added Files:
	panel-randr-crashes.patch 
Log Message:
fix randr-related  crashes


panel-randr-crashes.patch:
 panel-multiscreen.c |   36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

--- NEW FILE panel-randr-crashes.patch ---
>From 66b8e290bd0b767183cba583917907940b5b425a Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz at gnome.org>
Date: Tue, 6 Oct 2009 12:47:52 +0200
Subject: [PATCH] [panel] Fix crashes in various conditions with the new randr code

If nothing had probed the randr screen resources before us and the X
server is supporting randr 1.3, then we got no output, and therefore no
monitor. The fix here is to actively probe for resources if we detect
this case. See https://bugzilla.gnome.org/show_bug.cgi?id=597101

Also, in some cases, all outputs appear disconnected. See
https://bugzilla.novell.com/show_bug.cgi?id=543876

To be completely on the safe side, if we get no monitor information from
randr, even if it is successful, we fallback to the GTK+ method.
---
 gnome-panel/panel-multiscreen.c |   35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/gnome-panel/panel-multiscreen.c b/gnome-panel/panel-multiscreen.c
index 8a05221..4ed76ae 100644
--- a/gnome-panel/panel-multiscreen.c
+++ b/gnome-panel/panel-multiscreen.c
@@ -136,9 +136,17 @@ panel_multiscreen_get_randr_monitors_for_screen (GdkScreen     *screen,
 	xroot = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen));
 
 #if (RANDR_MAJOR > 1 || (RANDR_MAJOR == 1 && RANDR_MINOR >= 3))
-	if (have_randr_1_3)
+	if (have_randr_1_3) {
 		resources = XRRGetScreenResourcesCurrent (xdisplay, xroot);
-	else
+		if (resources->noutput == 0) {
+			/* This might happen if nothing tried to get randr
+			 * resources from the server before, so we need an
+			 * active probe. See comment #27 in
+			 * https://bugzilla.gnome.org/show_bug.cgi?id=597101 */
+			XRRFreeScreenResources (resources);
+			resources = XRRGetScreenResources (xdisplay, xroot);
+		}
+	} else
 		resources = XRRGetScreenResources (xdisplay, xroot);
 #else
 	resources = XRRGetScreenResources (xdisplay, xroot);
@@ -205,6 +213,17 @@ panel_multiscreen_get_randr_monitors_for_screen (GdkScreen     *screen,
 		return FALSE;
 	}
 
+	if (geometries->len == 0) {
+		/* This can happen in at least one case:
+		 * https://bugzilla.novell.com/show_bug.cgi?id=543876 where all
+		 * monitors appear disconnected (possibly because the  screen
+		 * is behing a KVM switch) -- see comment #8.
+		 * There might be other cases too, so we stay on the safe side.
+		 */
+		g_array_free (geometries, TRUE);
+		return FALSE;
+	}
+
 	*monitors_ret = geometries->len;
 	*geometries_ret = (GdkRectangle *) g_array_free (geometries, FALSE);
 
@@ -238,9 +257,15 @@ panel_multiscreen_get_raw_monitors_for_screen (GdkScreen     *screen,
 					       int           *monitors_ret,
 					       GdkRectangle **geometries_ret)
 {
-	if (panel_multiscreen_get_randr_monitors_for_screen (screen,
-							     monitors_ret,
-							     geometries_ret))
+	gboolean res;
+
+	*monitors_ret = 0;
+	*geometries_ret = NULL;
+
+	res = panel_multiscreen_get_randr_monitors_for_screen (screen,
+							       monitors_ret,
+							       geometries_ret);
+	if (res && *monitors_ret > 0)
 		return;
 
 	panel_multiscreen_get_gdk_monitors_for_screen (screen,
-- 
1.6.4.2

Index: gnome-panel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-panel/F-12/gnome-panel.spec,v
retrieving revision 1.372
retrieving revision 1.373
diff -u -p -r1.372 -r1.373
--- gnome-panel.spec	8 Oct 2009 04:56:14 -0000	1.372
+++ gnome-panel.spec	8 Oct 2009 17:56:46 -0000	1.373
@@ -22,7 +22,7 @@
 Summary: GNOME panel
 Name: gnome-panel
 Version: 2.28.0
-Release: 3%{?dist}
+Release: 4%{?dist}
 URL: http://www.gnome.org
 Source0: http://download.gnome.org/sources/gnome-panel/2.28/%{name}-%{version}.tar.bz2
 
@@ -114,6 +114,9 @@ Patch38: clock-network.patch
 Patch40: clock-home.patch
 Patch41: bookmarks-submenu.patch
 
+# from upstream
+Patch42: panel-randr-crashes.patch
+
 Conflicts: gnome-power-manager < 2.15.3
 
 %description
@@ -161,6 +164,7 @@ Panel Applets using the libpanel-applet 
 %patch38 -p1 -b .clock-network
 %patch40 -p1 -b .clock-home
 %patch41 -p1 -b .bookmarks-submenu
+%patch42 -p1 -b .randr-crashes
 
 . %{SOURCE6}
 
@@ -359,6 +363,9 @@ fi
 %{_datadir}/gtk-doc/html/*
 
 %changelog
+* Thu Oct  8 2009 Matthias Clasen <mclasen at redhat.com> 2.28.0-4
+- Fix possible crashes related to randr events
+
 * Thu Oct  8 2009 Matthias Clasen <mclasen at redhat.com> 2.28.0-3
 - Accept more bookmarks in the places menu before overflowing
 




More information about the fedora-extras-commits mailing list