From 2f0955a2bfae4a4185ca337e1e2f7e3a8621111d Mon Sep 17 00:00:00 2001
From: Benedikt Meurer <benny@xfce.org>
Date: Sat, 25 Jun 2005 11:17:15 +0000
Subject: [PATCH] Don't crash if the MCS plugin is unable to store the
 settings, a warning telling whats wrong will be emitted by libxfce4util, see
 bug #1033.

(Old svn revision: 16063)
---
 mcs-plugin/xfwm4_plugin.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/mcs-plugin/xfwm4_plugin.c b/mcs-plugin/xfwm4_plugin.c
index 9ce482796..8b6676573 100644
--- a/mcs-plugin/xfwm4_plugin.c
+++ b/mcs-plugin/xfwm4_plugin.c
@@ -2215,15 +2215,21 @@ write_options (McsPlugin * mcs_plugin)
 
     path = g_build_filename ("xfce4", "mcs_settings", RCFILE1, NULL);
     rcfile = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, path, TRUE);    
-    result = mcs_manager_save_channel_to_file (mcs_plugin->manager, CHANNEL1, rcfile);
+    if (G_LIKELY (rcfile == NULL))
+    {
+        result = mcs_manager_save_channel_to_file (mcs_plugin->manager, CHANNEL1, rcfile);
+        g_free (rcfile);
+    }
     g_free (path);
-    g_free (rcfile);
 
     path = g_build_filename ("xfce4", "mcs_settings", RCFILE2, NULL);
     rcfile = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, path, TRUE);    
-    result = mcs_manager_save_channel_to_file (mcs_plugin->manager, CHANNEL2, rcfile);
+    if (G_LIKELY (rcfile == NULL))
+    {
+        result = mcs_manager_save_channel_to_file (mcs_plugin->manager, CHANNEL2, rcfile);
+        g_free (rcfile);
+    }
     g_free (path);
-    g_free (rcfile);
 
     return result;
 }
-- 
GitLab