kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16.git/commit/?id=0df0320da641cda984e60874a755a2b037e3ca1c

commit 0df0320da641cda984e60874a755a2b037e3ca1c
Author: Kim Woelders <[email protected]>
Date:   Mon May 4 08:14:02 2020 +0200

    groups.c: Fix group deletion
    
    The loop construct did not delete all groups.
    
    Do group destruction after loop to avoid accessing deleted
    group->num_members.
---
 src/groups.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/groups.c b/src/groups.c
index bc4884ad..8feba8ba 100644
--- a/src/groups.c
+++ b/src/groups.c
@@ -329,7 +329,6 @@ _GroupEwinRemove(Group * g, EWin * ewin)
 static void
 _GroupDelete(Group * g)
 {
-   int                 i;
    EWin               *ewin;
 
    if (!g)
@@ -337,12 +336,14 @@ _GroupDelete(Group * g)
 
    Dprintf("group=%p gid=%d\n", g, g->index);
 
-   for (i = 0; i < g->num_members; i++)
+   g->save = 1;
+   while (g->num_members > 0)
      {
        ewin = g->members[0];
        _GroupEwinRemove(g, ewin);
        SnapshotEwinUpdate(ewin, SNAP_USE_GROUPS);
      }
+   _GroupDestroy(g);
 }
 
 Group             **

-- 


Reply via email to