[Xfce4-commits] [xfce/xfce4-session] 01/01: settings: Fix crash when terminating programs (Bug #15489)

noreply at xfce.org noreply at xfce.org
Mon Jun 17 00:01:00 CEST 2019


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-session.

commit 5f7d120c9646beeb0bcfad2b306f8f3ce81752ad
Author: Theo Linkspfeifer <lastonestanding at tutanota.com>
Date:   Sun Jun 16 23:59:07 2019 +0200

    settings: Fix crash when terminating programs (Bug #15489)
---
 settings/session-editor.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/settings/session-editor.c b/settings/session-editor.c
index a3bea1a..d8e412e 100644
--- a/settings/session-editor.c
+++ b/settings/session-editor.c
@@ -292,24 +292,17 @@ session_editor_quit_client(GtkWidget *btn,
         GError *error = NULL;
 
         if(hint != SmRestartIfRunning) {
-            GHashTable *properties = g_hash_table_new(g_str_hash, g_str_equal);
-            GValue val = { 0, };
+            GVariantBuilder properties;
             GVariant *variant;
 
-            g_value_init(&val, G_TYPE_UCHAR);
-            g_value_set_uchar(&val, SmRestartIfRunning);
-            g_hash_table_insert(properties, SmRestartStyleHint, &val);
-
-            variant = g_variant_new ("a{sv}", properties);
+            g_variant_builder_init (&properties, G_VARIANT_TYPE ("a{sv}"));
+            variant = g_variant_new_byte(SmRestartIfRunning);
+            g_variant_builder_add (&properties, "{sv}", SmRestartStyleHint, variant);
 
-            if(!xfsm_client_call_set_sm_properties_sync(proxy, variant, NULL, &error)) {
-                /* FIXME: show error */
-                g_error_free(error);
+            if(!xfsm_client_call_set_sm_properties_sync(proxy, g_variant_builder_end (&properties), NULL, &error)) {
+                g_error("error setting 'SmRestartStyleHint', error: %s", error->message);
+                g_clear_error(&error);
             }
-
-            g_value_unset(&val);
-            g_hash_table_destroy(properties);
-            g_variant_unref(variant);
         }
 
         if(!xfsm_client_call_terminate_sync(proxy, NULL, &error)) {
@@ -640,7 +633,7 @@ priority_changed(GtkCellRenderer *render,
 
             if(!xfsm_client_call_set_sm_properties_sync(proxy, g_variant_builder_end (&properties), NULL, &error)) {
                 g_error("error setting 'GsmPriority', error: %s", error->message);
-                g_error_free(error);
+                g_clear_error(&error);
             }
 
             gtk_list_store_set (GTK_LIST_STORE (model), &iter,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list