metacity r3840 - in trunk: . src/core



Author: tthurman
Date: Mon Sep  1 03:10:31 2008
New Revision: 3840
URL: http://svn.gnome.org/viewvc/metacity?rev=3840&view=rev

Log:
2008-09-01  Thomas Thurman  <tthurman gnome org>

        * src/core/workspace.c: When a workspace's list of struts
          is freed, free the struts too.  Closes #549952, and #468075.



Modified:
   trunk/ChangeLog
   trunk/src/core/workspace.c

Modified: trunk/src/core/workspace.c
==============================================================================
--- trunk/src/core/workspace.c	(original)
+++ trunk/src/core/workspace.c	Mon Sep  1 03:10:31 2008
@@ -35,6 +35,9 @@
 static void focus_ancestor_or_mru_window (MetaWorkspace *workspace,
                                           MetaWindow    *not_this_one,
                                           guint32        timestamp);
+static void free_this                    (gpointer candidate,
+                                          gpointer dummy);
+static void workspace_free_struts        (MetaWorkspace *workspace);
 
 static void
 maybe_add_to_list (MetaScreen *screen, MetaWindow *window, gpointer data)
@@ -79,6 +82,29 @@
   return workspace;
 }
 
+/** Foreach function for workspace_free_struts() */
+static void
+free_this (gpointer candidate, gpointer dummy)
+{
+  g_free (candidate);
+}
+
+/**
+ * Frees the struts list of a workspace.
+ *
+ * \param workspace  The workspace.
+ */
+static void
+workspace_free_struts (MetaWorkspace *workspace)
+{
+  if (workspace->all_struts == NULL)
+    return;
+    
+  g_slist_foreach (workspace->all_struts, free_this, NULL);
+  g_slist_free (workspace->all_struts);
+  workspace->all_struts = NULL;
+}
+
 void
 meta_workspace_free (MetaWorkspace *workspace)
 {
@@ -127,7 +153,7 @@
 
   if (!workspace->work_areas_invalid)
     {
-      g_slist_free (workspace->all_struts);
+      workspace_free_struts (workspace);
       for (i = 0; i < screen->n_xinerama_infos; i++)
         meta_rectangle_free_list_and_elements (workspace->xinerama_region[i]);
       g_free (workspace->xinerama_region);
@@ -457,8 +483,7 @@
   g_free (workspace->work_area_xinerama);
   workspace->work_area_xinerama = NULL;
       
-  g_slist_free (workspace->all_struts);
-  workspace->all_struts = NULL;
+  workspace_free_struts (workspace);
 
   for (i = 0; i < workspace->screen->n_xinerama_infos; i++)
     meta_rectangle_free_list_and_elements (workspace->xinerama_region[i]);



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