Re: [dev] [tabbed] bug in cleanup function
On Thu, Nov 06, 2025 at 05:40:02PM +0100, Markus Wichmann wrote:
> Am Thu, Nov 06, 2025 at 11:49:20AM +0300 schrieb Ivan Vetrov:
> > Hi,
> >
> > In the cleanup function there is a loop
> >
> > for (i = 0; i < nclients; i++) {
> > focus(i);
> > killclient(NULL);
> > XReparentWindow(dpy, clients[i]->win, root, 0, 0);
> > unmanage(i);
> > }
> >
> > which is buggy because unmanage decreases the global variable nclients by
> > one and also affects the memory pointed to by clients, so it actually
> > destroys only clients with even indices. I think it can be fixed by destroying
> > the 0th client nclients times or by iterating in reverse order (as in the
> > attached patch).
> >
>
> I am wondering if the unmanage() call is even needed here. unmanage()
> seems to only clean up some memory, but cleanup() is only called when
> the process is about to end, and the kernel will clean up the memory
> more thoroughly than the application ever can.
>
> Ciao,
> Markus
>
I think you're right - after compiling with just unmanage() call removed,
tabbed closes properly for me.
Best,
Ivan
P.S.
I'm sorry for accidentally sending the first message multiple times.
Received on Thu Nov 06 2025 - 19:55:19 CET
This archive was generated by hypermail 2.3.0
: Thu Nov 06 2025 - 20:00:09 CET