Merge lp:~charlesk/indicator-session/lp-957342 into lp:indicator-session/0.4

Proposed by Charles Kerr
Status: Merged
Approved by: Charles Kerr
Approved revision: 251
Merged at revision: 250
Proposed branch: lp:~charlesk/indicator-session/lp-957342
Merge into: lp:indicator-session/0.4
Diff against target: 59 lines (+9/-14)
2 files modified
src/device-menu-mgr.c (+4/-3)
src/indicator-session.c (+5/-11)
To merge this branch: bzr merge lp:~charlesk/indicator-session/lp-957342
Reviewer Review Type Date Requested Status
Conor Curran (community) Approve
Review via email: mp+97965@code.launchpad.net
To post a comment you must log in.
250. By Charles Kerr

plug two more memory leaks. g_variant_get("s") makes a newly-allocated duplicated string, g_variant_get("&s") returns the internal const string.

251. By Charles Kerr

fix memory leak updating the username label -- gtk_label_set_text() takes a const char*, we don't need to g_strdup() the string before passing it in

Revision history for this message
Conor Curran (cjcurran) wrote :

Well spotted !

Revision history for this message
Conor Curran (cjcurran) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/device-menu-mgr.c'
--- src/device-menu-mgr.c 2012-02-23 14:40:17 +0000
+++ src/device-menu-mgr.c 2012-03-17 00:26:18 +0000
@@ -166,11 +166,12 @@
166 }166 }
167167
168 if (g_strcmp0 (key, KEY_LOCK_SCREEN) == 0) {168 if (g_strcmp0 (key, KEY_LOCK_SCREEN) == 0) {
169 g_debug("Keybinding changed to: %s", g_settings_get_string(settings, key));169 gchar * val = g_settings_get_string(settings, key);
170 g_debug("Keybinding changed to: %s", val);
170 if (lock_menuitem != NULL) {171 if (lock_menuitem != NULL) {
171 dbusmenu_menuitem_property_set_shortcut_string (lock_menuitem,172 dbusmenu_menuitem_property_set_shortcut_string (lock_menuitem, val);
172 g_settings_get_string(settings, key));
173 }173 }
174 g_free (val);
174 }175 }
175 return;176 return;
176}177}
177178
=== modified file 'src/indicator-session.c'
--- src/indicator-session.c 2012-02-23 05:22:14 +0000
+++ src/indicator-session.c 2012-03-17 00:26:18 +0000
@@ -428,7 +428,7 @@
428 }428 }
429 429
430 const gchar* username = NULL;430 const gchar* username = NULL;
431 g_variant_get (result, "(s)", &username);431 g_variant_get (result, "(&s)", &username);
432 indicator_session_update_users_label (self, username);432 indicator_session_update_users_label (self, username);
433 return;433 return;
434}434}
@@ -481,7 +481,7 @@
481481
482 if (g_strcmp0(signal_name, "UserRealNameUpdated") == 0) {482 if (g_strcmp0(signal_name, "UserRealNameUpdated") == 0) {
483 const gchar* username = NULL;483 const gchar* username = NULL;
484 g_variant_get (parameters, "(s)", &username);484 g_variant_get (parameters, "(&s)", &username);
485 indicator_session_update_users_label (self, username); 485 indicator_session_update_users_label (self, username);
486 }486 }
487 else if (g_strcmp0(signal_name, "UserMenuIsVisible") == 0) {487 else if (g_strcmp0(signal_name, "UserMenuIsVisible") == 0) {
@@ -713,14 +713,8 @@
713 } 713 }
714714
715 GSettings* settings = g_settings_new ("com.canonical.indicator.session");715 GSettings* settings = g_settings_new ("com.canonical.indicator.session");
716 gboolean use_name = g_settings_get_boolean (settings,716 const gboolean use_name = g_settings_get_boolean (settings, "show-real-name-on-panel");
717 "show-real-name-on-panel"); 717 gtk_label_set_text (self->users.label, name);
718 gtk_widget_set_visible (GTK_WIDGET(self->users.label), use_name);
718 g_object_unref (settings);719 g_object_unref (settings);
719 gtk_label_set_text (self->users.label, g_strdup(name));
720 if (use_name){
721 gtk_widget_show(GTK_WIDGET(self->users.label));
722 }
723 else{
724 gtk_widget_hide(GTK_WIDGET(self->users.label));
725 }
726}720}

Subscribers

People subscribed via source and target branches