]> git.sur5r.net Git - i3/i3/commitdiff
Free ws_assignments on reload 3353/head
authorOrestis Floros <orestisf1993@gmail.com>
Thu, 9 Aug 2018 14:28:05 +0000 (17:28 +0300)
committerOrestis Floros <orestisf1993@gmail.com>
Thu, 9 Aug 2018 14:28:05 +0000 (17:28 +0300)
This fixes an unreported bug where deleting a workspace assignment and
reloading the config file would keep the assignment.

src/config.c

index ab19bae314ef2404dbc41bbd4c020341e7cc610b..5be1fd521faa58a1f99c52333ca7c9b60f866f95 100644 (file)
@@ -97,9 +97,8 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
             FREE(mode);
         }
 
-        struct Assignment *assign;
         while (!TAILQ_EMPTY(&assignments)) {
-            assign = TAILQ_FIRST(&assignments);
+            struct Assignment *assign = TAILQ_FIRST(&assignments);
             if (assign->type == A_TO_WORKSPACE || assign->type == A_TO_WORKSPACE_NUMBER)
                 FREE(assign->dest.workspace);
             else if (assign->type == A_COMMAND)
@@ -111,6 +110,14 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
             FREE(assign);
         }
 
+        while (!TAILQ_EMPTY(&ws_assignments)) {
+            struct Workspace_Assignment *assign = TAILQ_FIRST(&ws_assignments);
+            FREE(assign->name);
+            FREE(assign->output);
+            TAILQ_REMOVE(&ws_assignments, assign, ws_assignments);
+            FREE(assign);
+        }
+
         /* Clear bar configs */
         Barconfig *barconfig;
         while (!TAILQ_EMPTY(&barconfigs)) {