From c16c70bdacd5cc65f3c52200ff82b01d3fd5b9c5 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Oct 22 2007 16:57:12 +0000 Subject: don't crash gnome-system-monitor if the X Resource extension is missing --- diff --git a/libwnck.spec b/libwnck.spec index bb0c24f..570769f 100644 --- a/libwnck.spec +++ b/libwnck.spec @@ -6,7 +6,7 @@ Summary: Window Navigator Construction Kit Name: libwnck Version: 2.20.1 -Release: 1%{?dist} +Release: 2%{?dist} URL: http://download.gnome.org/sources/libwnck/ Source0: http://download.gnome.org/sources/libwnck/2.20/%{name}-%{version}.tar.bz2 License: LGPLv2+ @@ -27,10 +27,12 @@ BuildRequires: perl(XML::Parser) BuildRequires: gettext # http://bugzilla.gnome.org/show_bug.cgi?id=352383 -Patch3: libwnck-2.19.4-appearance.patch -Patch5: libwnck-2.18.0-above.patch +Patch0: libwnck-2.19.4-appearance.patch +Patch1: libwnck-2.18.0-above.patch # http://bugzilla.gnome.org/show_bug.cgi?id=459984 -Patch6: crash-on-shutdown.patch +Patch2: crash-on-shutdown.patch +# http://bugzilla.gnome.org/show_bug.cgi?id=489087 +Patch3: no-resource-extension.patch %description @@ -61,9 +63,10 @@ just to use precompiled applications. %prep %setup -q -%patch3 -p1 -b .appearance -%patch5 -p1 -b .above -%patch6 -p1 -b .crash-on-shutdown +%patch0 -p1 -b .appearance +%patch1 -p1 -b .above +%patch2 -p1 -b .crash-on-shutdown +%patch3 -p1 -b .no-resource-extension %build @@ -100,6 +103,9 @@ rm -rf $RPM_BUILD_ROOT %doc %{_datadir}/gtk-doc/html/libwnck %changelog +* Mon Oct 22 2007 Matthias Clasen - 2.20.1-2 +- Don't crash if the X resource extension is missing (#343881) + * Mon Oct 15 2007 Matthias Clasen - 2.20.1-1 - Update to 2.20.1 (crash fixes, translation updates) diff --git a/no-resource-extension.patch b/no-resource-extension.patch new file mode 100644 index 0000000..7f52e22 --- /dev/null +++ b/no-resource-extension.patch @@ -0,0 +1,96 @@ +diff -up libwnck-2.20.1/libwnck/util.c.no-resource-extension libwnck-2.20.1/libwnck/util.c +--- libwnck-2.20.1/libwnck/util.c.no-resource-extension 2007-10-22 12:36:51.000000000 -0400 ++++ libwnck-2.20.1/libwnck/util.c 2007-10-22 12:36:55.000000000 -0400 +@@ -114,32 +114,13 @@ _wnck_print_resource_usage (WnckResource + } + #endif + +-/** +- * wnck_xid_read_resource_usage: +- * @gdk_display: a GdkDisplay. +- * @xid: an X window ID. +- * @usage: return location for the X resource usage of the application owning +- * the X window ID @xid. +- * +- * Looks for the X resource usage of the application owning the X window ID +- * @xid on display @gdisplay. If no resource usage can be found, then all +- * fields of @usage are set to 0. +- * +- * To properly work, this function requires the XRes extension on the X server. +- * +- * Since: 2.6 +- */ +-void +-wnck_xid_read_resource_usage (GdkDisplay *gdisplay, +- gulong xid, +- WnckResourceUsage *usage) ++static WnckExtStatus ++wnck_init_resource_usage (GdkDisplay *gdisplay) + { + int event, error; + Display *xdisplay; + WnckExtStatus status; + +- g_return_if_fail (usage != NULL); +- + xdisplay = GDK_DISPLAY_XDISPLAY (gdisplay); + + status = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (gdisplay), +@@ -163,13 +144,37 @@ wnck_xid_read_resource_usage (GdkDisplay + + g_assert (status != WNCK_EXT_UNKNOWN); + +- memset (usage, '\0', sizeof (*usage)); +- +- if (status == WNCK_EXT_MISSING) ++ return status; ++} ++ ++/** ++ * wnck_xid_read_resource_usage: ++ * @gdk_display: a GdkDisplay. ++ * @xid: an X window ID. ++ * @usage: return location for the X resource usage of the application owning ++ * the X window ID @xid. ++ * ++ * Looks for the X resource usage of the application owning the X window ID ++ * @xid on display @gdisplay. If no resource usage can be found, then all ++ * fields of @usage are set to 0. ++ * ++ * To properly work, this function requires the XRes extension on the X server. ++ * ++ * Since: 2.6 ++ */ ++void ++wnck_xid_read_resource_usage (GdkDisplay *gdisplay, ++ gulong xid, ++ WnckResourceUsage *usage) ++{ ++ g_return_if_fail (usage != NULL); ++ ++ if (wnck_init_resource_usage (gdisplay) == WNCK_EXT_MISSING) + return; + + #ifdef HAVE_XRES + { ++ Display *xdisplay; + XResType *types; + int n_types; + unsigned long pixmap_bytes; +@@ -608,12 +613,12 @@ wnck_pid_read_resource_usage (GdkDisplay + { + g_return_if_fail (usage != NULL); + +-#ifndef HAVE_XRES +- memset (usage, '\0', sizeof (*usage)); +- return; +-#else + memset (usage, '\0', sizeof (*usage)); + ++ if (wnck_init_resource_usage (gdisplay) == WNCK_EXT_MISSING) ++ return; ++ ++#ifdef HAVE_XRES + if (!wnck_pid_read_resource_usage_from_cache (gdisplay, pid, usage)) + /* the cache might not be built, might be outdated or might not contain + * data for a new X client, so try to fallback to something else */