Re: [i3] [PATCH] Use ev_break() rather than exit() in i3bar.
- From: Michael Stapelberg <michael@xxxxxxxx>
- To: i3-discuss <i3-discuss@xxxxxxxxxxxxx>
- Date: Mon, 26 Mar 2012 17:36:51 +0200
Hi darkraven,
Excerpts from DR's message of 2012-03-03 13:29:52 +0100:
If i3bar is running in hide mode, when i3wm exit, i3bar will exit
without killing its child process, leaving a couple of processes in
'T' mode (i.e. Stopped).
Good catch, thanks.
I'm not very sure I've done things right. I might change some exit()s
called before ev_loop() into ev_break(), or leave some exit()s
unconverted. Someone please review this patch.
Here are a few comments about your patch:
1) You changed a few variables without any obvious reason. Please don’t do
that, always keep patches minimal.
2) Instead of using ev_break(main_loop, EVBREAK_ALL), the ev manpage suggests
ev_break(EV_A_ EVBREAK_ALL); within a handler.
3) Why do you even bother to communicate an exit status? i3bar is a
forever-running process. When it exits, it failed by definition. The exit
code can always be EXIT_FAILURE.
4) You don’t need to free memory before exiting, the OS will clean it up when
the process exits.
But, most importantly, taking a step back from all this: When you call ev_break
and return from one function, the code of another function might still be
executed (I think this is what Fernando was trying to say). Thus, ev_break +
return is actually not equivalent to exit().
Therefore, I just pushed commit
http://c.i3wm.org/d519659, which works for me
to fix this problem.
Best regards,
Michael
Other related posts: