[Xfce4-commits] [xfce/xfce4-settings] 01/01: Fix two possible crashes when changing desktop names
noreply at xfce.org
noreply at xfce.org
Tue Oct 21 03:24:43 CEST 2014
This is an automated email from the git hooks/post-receive script.
bluesabre pushed a commit to branch master
in repository xfce/xfce4-settings.
commit 3baa0287875895ef74f492c32a76a522e0b4edea
Author: Alistair Buxton <a.j.buxton at gmail.com>
Date: Sun Oct 12 21:15:12 2014 +0100
Fix two possible crashes when changing desktop names
1. Fix a crash when non-string values are put into the xfconf property.
Do not attempt to use these values as strings. Instead, create a default value.
The result is copied back into xfconf when the atom is updated. Test case:
xfconf-query -c xfwm4 -p /general/workspace_names -t int -s 1 -t int -s 2
2. Fix a crash when the _NET_DESKTOP_NAMES atom is changed on the root window.
Reinitialize as a string after the unset.
xprop -root -f '_NET_DESKTOP_NAMES' 8u -set '_NET_DESKTOP_NAMES' 'hello'
Fixes https://bugzilla.xfce.org/show_bug.cgi?id=11229
Signed-off-by: Sean Davis <smd.seandavis at gmail.com>
---
xfsettingsd/workspaces.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/xfsettingsd/workspaces.c b/xfsettingsd/workspaces.c
index 3237504..f1e6bc5 100644
--- a/xfsettingsd/workspaces.c
+++ b/xfsettingsd/workspaces.c
@@ -325,10 +325,21 @@ xfce_workspaces_helper_set_names_real (XfceWorkspacesHelper *helper)
for (i = 0; i < names->len && i < n_workspaces; i++)
{
val = g_ptr_array_index (names, i);
- name = g_value_get_string (val);
+ if (G_VALUE_HOLDS_STRING(val))
+ {
+ name = g_value_get_string (val);
- /* insert the name with nul */
- g_string_append_len (names_str, name, strlen (name) + 1);
+ /* insert the name with nul */
+ g_string_append_len (names_str, name, strlen (name) + 1);
+ }
+ else
+ {
+ /* value in xfconf isn't a string, so make a default one */
+ new_name = g_strdup_printf (_("Workspace %d"), i + 1);
+ /* insert the name with nul */
+ g_string_append_len (names_str, new_name, strlen (new_name) + 1);
+ g_free (new_name);
+ }
}
/* update stamp so new names is not handled for the next second */
@@ -546,6 +557,7 @@ xfce_workspaces_helper_save_names (XfceWorkspacesHelper *helper)
{
/* set the old xfconf name to the new name */
g_value_unset (val_b);
+ g_value_init (val_b, G_TYPE_STRING);
g_value_set_string (val_b, name_a);
save_array = TRUE;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list