[Xfce4-commits] r29726 - in xfwm4/trunk: . src

Olivier Fourdan olivier at xfce.org
Wed Apr 8 12:55:36 CEST 2009


Author: olivier
Date: 2009-04-08 10:55:35 +0000 (Wed, 08 Apr 2009)
New Revision: 29726

Modified:
   xfwm4/trunk/ChangeLog
   xfwm4/trunk/NEWS
   xfwm4/trunk/src/events.c
   xfwm4/trunk/src/parserc.c
   xfwm4/trunk/src/settings.c
Log:
	* src/parserc.c, src/settings.c, src/events.c: Plug various memory
	  leaks

Modified: xfwm4/trunk/ChangeLog
===================================================================
--- xfwm4/trunk/ChangeLog	2009-04-07 22:53:42 UTC (rev 29725)
+++ xfwm4/trunk/ChangeLog	2009-04-08 10:55:35 UTC (rev 29726)
@@ -1,3 +1,8 @@
+2009-04-08	olivier
+
+	* src/parserc.c, src/settings.c, src/events.c: Plug various memory
+	  leaks
+
 2009-04-07	olivier
 
 	* src/compositor.c: Make fullscreen override opaque, so screensaver

Modified: xfwm4/trunk/NEWS
===================================================================
--- xfwm4/trunk/NEWS	2009-04-07 22:53:42 UTC (rev 29725)
+++ xfwm4/trunk/NEWS	2009-04-08 10:55:35 UTC (rev 29726)
@@ -15,7 +15,9 @@
   (Bug #5030)
 - Check fullscreen status against each monitor and not just the overall screen
   size in the compositor. 
+- Plug various memory leaks
 
+
 4.6.0
 =====
 

Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c	2009-04-07 22:53:42 UTC (rev 29725)
+++ xfwm4/trunk/src/events.c	2009-04-08 10:55:35 UTC (rev 29726)
@@ -1762,6 +1762,13 @@
         else if (ev->atom == XA_WM_HINTS)
         {
             TRACE ("client \"%s\" (0x%lx) has received a XA_WM_HINTS notify", c->name, c->window);
+
+            /* Free previous wmhints if any */
+            if (c->wmhints)
+            {
+                XFree (c->wmhints);
+            }
+
             c->wmhints = XGetWMHints (display_info->dpy, c->window);
             if (c->wmhints)
             {

Modified: xfwm4/trunk/src/parserc.c
===================================================================
--- xfwm4/trunk/src/parserc.c	2009-04-07 22:53:42 UTC (rev 29725)
+++ xfwm4/trunk/src/parserc.c	2009-04-08 10:55:35 UTC (rev 29726)
@@ -213,7 +213,7 @@
 {
     GValue tmp_val = {0, };
     g_value_init(&tmp_val, G_TYPE_STRING);
-    g_value_set_string(&tmp_val, value);
+    g_value_set_static_string(&tmp_val, value);
     return setGValue (lvalue, &tmp_val, rc);
 }
 

Modified: xfwm4/trunk/src/settings.c
===================================================================
--- xfwm4/trunk/src/settings.c	2009-04-07 22:53:42 UTC (rev 29725)
+++ xfwm4/trunk/src/settings.c	2009-04-08 10:55:35 UTC (rev 29726)
@@ -305,6 +305,7 @@
 static void
 loadTheme (ScreenInfo *screen_info, Settings *rc)
 {
+
     static const char *side_names[] = {
         "left",
         "right",
@@ -338,6 +339,58 @@
         "toggled-pressed"
     };
 
+    static const char *ui_part[] = {
+        "fg",
+        "fg",
+        "dark",
+        "dark",
+        "fg",
+        "fg",
+        "bg",
+        "light",
+        "dark",
+        "mid",
+        "bg",
+        "light",
+        "dark",
+        "mid",
+        "bg",
+        "light",
+        "dark",
+        "mid",
+        "bg",
+        "light",
+        "dark",
+        "mid",
+        NULL
+    };
+
+    static const char *ui_state[] = {
+        "selected",
+        "insensitive",
+        "selected",
+        "insensitive",
+        "normal",
+        "normal",
+        "selected",
+        "selected",
+        "selected",
+        "selected",
+        "normal",
+        "normal",
+        "normal",
+        "normal",
+        "insensitive",
+        "insensitive",
+        "insensitive",
+        "insensitive",
+        "normal",
+        "normal",
+        "normal",
+        "normal",
+        NULL
+    };
+
     gchar imagename[30];
     GValue tmp_val = { 0, };
     DisplayInfo *display_info;
@@ -354,30 +407,17 @@
 
     desc = NULL;
     context = NULL;
+    i = 0;
 
-    setStringValue (rc[0].option, getUIStyle (widget, "fg",    "selected"), rc);
-    setStringValue (rc[1].option, getUIStyle (widget, "fg",    "insensitive"), rc);
-    setStringValue (rc[2].option, getUIStyle (widget, "dark",  "selected"), rc);
-    setStringValue (rc[3].option, getUIStyle (widget, "dark",  "insensitive"), rc);
-    setStringValue (rc[4].option, getUIStyle (widget, "fg",    "normal"), rc);
-    setStringValue (rc[5].option, getUIStyle (widget, "fg",    "normal"), rc);
-    setStringValue (rc[6].option, getUIStyle (widget, "bg",    "selected"), rc);
-    setStringValue (rc[7].option, getUIStyle (widget, "light", "selected"), rc);
-    setStringValue (rc[8].option, getUIStyle (widget, "dark",  "selected"), rc);
-    setStringValue (rc[9].option, getUIStyle (widget, "mid",   "selected"), rc);
-    setStringValue (rc[10].option, getUIStyle (widget, "bg",    "normal"), rc);
-    setStringValue (rc[11].option, getUIStyle (widget, "light", "normal"), rc);
-    setStringValue (rc[12].option, getUIStyle (widget, "dark",  "normal"), rc);
-    setStringValue (rc[13].option, getUIStyle (widget, "mid",   "normal"), rc);
-    setStringValue (rc[14].option, getUIStyle (widget, "bg",    "insensitive"), rc);
-    setStringValue (rc[15].option, getUIStyle (widget, "light", "insensitive"), rc);
-    setStringValue (rc[16].option, getUIStyle (widget, "dark",  "insensitive"), rc);
-    setStringValue (rc[17].option, getUIStyle (widget, "mid",   "insensitive"), rc);
-    setStringValue (rc[18].option, getUIStyle (widget, "bg",    "normal"), rc);
-    setStringValue (rc[19].option, getUIStyle (widget, "light", "normal"), rc);
-    setStringValue (rc[20].option, getUIStyle (widget, "dark",  "normal"), rc);
-    setStringValue (rc[21].option, getUIStyle (widget, "mid",   "normal"), rc);
+    while (ui_part[i] && ui_state[i])
+    {
+        gchar *color;
 
+        color = getUIStyle  (widget, ui_part[i], ui_state[i]);
+        setStringValue (rc[i].option, color, rc);
+        g_free (color);
+        ++i;
+    }
 
     theme = getThemeDir (getStringValue ("theme", rc), THEMERC);
     parseRc (THEMERC, theme, rc);
@@ -688,7 +728,6 @@
     TRACE ("entering loadSettings");
 
     loadRcData (screen_info, rc);
-    loadRcData (screen_info, rc);
     loadXfconfData (screen_info, rc);
     loadTheme (screen_info, rc);
     update_grabs (screen_info);
@@ -897,7 +936,7 @@
 {
     g_return_val_if_fail (screen_info, FALSE);
 
-    unloadTheme (screen_info);
+    unloadSettings (screen_info);
     if (!loadSettings (screen_info))
     {
         return FALSE;




More information about the Xfce4-commits mailing list