[gnome-session] shell: don't leak inhibitor list on updates
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] shell: don't leak inhibitor list on updates
- Date: Tue, 22 Mar 2011 17:17:00 +0000 (UTC)
commit 66dbc4d171e49b58932bb3151b06ebda1fc8e4ca
Author: Ray Strode <rstrode redhat com>
Date: Tue Mar 22 10:50:57 2011 -0400
shell: don't leak inhibitor list on updates
gsm_shell_open_end_session_dialog takes a reference
to a passed in inhibitor store.
This function is explicitly called by the manager
whenever a log out should happen, but also gets
implicitly called whenever the inhibitor store is
changed.
This commit makes sure we don't leak a reference to the
store during implicit calls to
gsm_shell_open_end_session_dialog.
https://bugzilla.gnome.org/show_bug.cgi?id=645485
gnome-session/gsm-shell.c | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/gnome-session/gsm-shell.c b/gnome-session/gsm-shell.c
index fb5f4ed..9bbd09f 100644
--- a/gnome-session/gsm-shell.c
+++ b/gnome-session/gsm-shell.c
@@ -611,14 +611,24 @@ gsm_shell_open_end_session_dialog (GsmShell *shell,
return FALSE;
}
- shell->priv->inhibitors = g_object_ref (inhibitors);
- g_signal_connect_swapped (inhibitors, "added",
- G_CALLBACK (queue_end_session_dialog_update),
- shell);
+ if (inhibitors != shell->priv->inhibitors) {
+ if (shell->priv->inhibitors != NULL) {
+ g_signal_handlers_disconnect_by_func (shell->priv->inhibitors,
+ G_CALLBACK (queue_end_session_dialog_update),
+ shell);
+ g_object_unref (shell->priv->inhibitors);
+ }
- g_signal_connect_swapped (inhibitors, "removed",
- G_CALLBACK (queue_end_session_dialog_update),
- shell);
+ shell->priv->inhibitors = g_object_ref (inhibitors);
+
+ g_signal_connect_swapped (inhibitors, "added",
+ G_CALLBACK (queue_end_session_dialog_update),
+ shell);
+
+ g_signal_connect_swapped (inhibitors, "removed",
+ G_CALLBACK (queue_end_session_dialog_update),
+ shell);
+ }
shell->priv->end_session_open_call = call;
shell->priv->end_session_dialog_type = type;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]