[gnome-shell] Fix double free and under-dup in ShellAppMonitor



commit 8f0bf5deae7463801c9da42e35e21f51a3077c50
Author: Colin Walters <walters verbum org>
Date:   Tue Jun 30 17:37:27 2009 -0400

    Fix double free and under-dup in ShellAppMonitor
    
    The hash table is keeping ownership of appid, we don't need
    to free it again.  However we do need to re-dup it when we
    insert as a key.

 src/shell-app-monitor.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/shell-app-monitor.c b/src/shell-app-monitor.c
index 6edf824..87b7f6c 100644
--- a/src/shell-app-monitor.c
+++ b/src/shell-app-monitor.c
@@ -347,12 +347,12 @@ shell_app_monitor_on_window_removed (MetaWorkspace   *workspace,
   if (window_count == 0)
     {
       g_hash_table_remove (self->running_appids, appid);
-      g_free (appid);
       g_signal_emit (self, signals[CHANGED], 0);
     }
   else
     {
-      g_hash_table_insert (self->running_appids, appid, GUINT_TO_POINTER (window_count));
+      g_hash_table_insert (self->running_appids, g_strdup (appid),
+                           GUINT_TO_POINTER (window_count));
     }
   g_hash_table_remove (self->window_to_appid, window);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]