workspace: Make the code for removing windows easier to read
Repeatedly pop off the head of the list rather than iterating through it.
This commit is contained in:
parent
7b8ee4ee1e
commit
5f7c901727
@ -246,7 +246,6 @@ workspace_free_builtin_struts (MetaWorkspace *workspace)
|
|||||||
void
|
void
|
||||||
meta_workspace_remove (MetaWorkspace *workspace)
|
meta_workspace_remove (MetaWorkspace *workspace)
|
||||||
{
|
{
|
||||||
GList *tmp;
|
|
||||||
MetaScreen *screen;
|
MetaScreen *screen;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -256,18 +255,13 @@ meta_workspace_remove (MetaWorkspace *workspace)
|
|||||||
* as well, so they won't be "orphaned"
|
* as well, so they won't be "orphaned"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tmp = workspace->windows;
|
while (workspace->windows != NULL)
|
||||||
while (tmp != NULL)
|
|
||||||
{
|
{
|
||||||
GList *next;
|
MetaWindow *window = workspace->windows->data;
|
||||||
MetaWindow *window = tmp->data;
|
|
||||||
next = tmp->next;
|
|
||||||
|
|
||||||
/* pop front of list we're iterating over */
|
/* pop front of list we're iterating over */
|
||||||
meta_workspace_remove_window (workspace, window);
|
meta_workspace_remove_window (workspace, window);
|
||||||
g_assert (window->workspace != NULL);
|
g_assert (window->workspace != NULL);
|
||||||
|
|
||||||
tmp = next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_assert (workspace->windows == NULL);
|
g_assert (workspace->windows == NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user