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.
This commit is contained in:
Colin Walters 2009-06-30 17:37:27 -04:00
parent 09d9d91297
commit 8f0bf5deae

View File

@ -347,12 +347,12 @@ shell_app_monitor_on_window_removed (MetaWorkspace *workspace,
if (window_count == 0) if (window_count == 0)
{ {
g_hash_table_remove (self->running_appids, appid); g_hash_table_remove (self->running_appids, appid);
g_free (appid);
g_signal_emit (self, signals[CHANGED], 0); g_signal_emit (self, signals[CHANGED], 0);
} }
else 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); g_hash_table_remove (self->window_to_appid, window);
} }