[Xfce4-commits] <xfwm4:xfce-4.8> Fix crash when workspace count is set to negative values (Bug #8002)

Olivier Fourdan noreply at xfce.org
Wed Oct 26 20:44:02 CEST 2011


Updating branch refs/heads/xfce-4.8
         to 2ab5b00d96bfe5df317c67c8317be78aeec3937d (commit)
       from bcda6a68b5adc3ab54cf1f741a325606155f6375 (commit)

commit 2ab5b00d96bfe5df317c67c8317be78aeec3937d
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Wed Oct 26 20:40:02 2011 +0200

    Fix crash when workspace count is set to negative values (Bug #8002)

 src/settings.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/settings.c b/src/settings.c
index 736a17b..0a9581e 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -873,9 +873,7 @@ loadSettings (ScreenInfo *screen_info)
 
     if (screen_info->workspace_count == 0)
     {
-        guint workspace_count;
-        workspace_count = MAX ((guint) getIntValue ("workspace_count", rc), 1);
-        workspaceSetCount (screen_info, workspace_count);
+        workspaceSetCount (screen_info, (guint) MAX (getIntValue ("workspace_count", rc), 1));
     }
 
     freeRc (rc);
@@ -1033,11 +1031,11 @@ initSettings (ScreenInfo *screen_info)
     }
     if (getHint (display_info, screen_info->xroot, NET_NUMBER_OF_DESKTOPS, &val))
     {
-        workspaceSetCount (screen_info, val);
+        workspaceSetCount (screen_info, (guint) MAX (val, 1));
     }
     else if (getHint (display_info, screen_info->xroot, WIN_WORKSPACE_COUNT, &val))
     {
-        workspaceSetCount (screen_info, val);
+        workspaceSetCount (screen_info, (guint) MAX (val, 1));
     }
 
     if (getUTF8StringList (display_info, screen_info->xroot, NET_DESKTOP_NAMES, &names, &i))
@@ -1150,7 +1148,7 @@ cb_xfwm4_channel_property_changed(XfconfChannel *channel, const gchar *property_
                 }
                 else if (!strcmp (name, "workspace_count"))
                 {
-                    workspaceSetCount(screen_info, g_value_get_int (value));
+                    workspaceSetCount(screen_info, (guint) MAX (g_value_get_int (value), 1));
                 }
                 else if (!strcmp (name, "frame_opacity"))
                 {


More information about the Xfce4-commits mailing list