diff options
author | Olivier Fourdan <fourdan.olivier@wanadoo.fr> | 2009-04-08 10:55:35 +0000 |
---|---|---|
committer | Olivier Fourdan <fourdan.olivier@wanadoo.fr> | 2009-04-08 10:55:35 +0000 |
commit | c14a2db37da0101adde8795608174527b1cf401a (patch) | |
tree | b5049b5cd6f81222eae9dc45078341fed2a3f6d5 | |
parent | ec761b2954164eed7fd72e2769d722605fa694dd (diff) | |
download | xfwm4-c14a2db37da0101adde8795608174527b1cf401a.tar.gz |
* src/parserc.c, src/settings.c, src/events.c: Plug various memory
leaks
(Old svn revision: 29726)
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | src/events.c | 7 | ||||
-rw-r--r-- | src/parserc.c | 2 | ||||
-rw-r--r-- | src/settings.c | 87 |
5 files changed, 78 insertions, 25 deletions
@@ -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 @@ -15,6 +15,8 @@ (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 ===== diff --git a/src/events.c b/src/events.c index 57b8b0f65..2d49ebc72 100644 --- a/src/events.c +++ b/src/events.c @@ -1762,6 +1762,13 @@ handlePropertyNotify (DisplayInfo *display_info, XPropertyEvent * ev) 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) { diff --git a/src/parserc.c b/src/parserc.c index 7e533f197..5f2eb6658 100644 --- a/src/parserc.c +++ b/src/parserc.c @@ -213,7 +213,7 @@ setStringValue (const gchar * lvalue, const gchar *value, Settings *rc) { 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); } diff --git a/src/settings.c b/src/settings.c index de74e5f55..a83723508 100644 --- a/src/settings.c +++ b/src/settings.c @@ -305,6 +305,7 @@ getTitleShadow (Settings *rc, const gchar * name) static void loadTheme (ScreenInfo *screen_info, Settings *rc) { + static const char *side_names[] = { "left", "right", @@ -338,6 +339,58 @@ loadTheme (ScreenInfo *screen_info, Settings *rc) "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 @@ loadTheme (ScreenInfo *screen_info, Settings *rc) 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 @@ loadSettings (ScreenInfo *screen_info) 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 @@ reloadScreenSettings (ScreenInfo *screen_info, int mask) { g_return_val_if_fail (screen_info, FALSE); - unloadTheme (screen_info); + unloadSettings (screen_info); if (!loadSettings (screen_info)) { return FALSE; |