cmd_exit: Let i3_exit handle shutdown (#3600)
- __lsan_do_leak_check() will terminate the process, so move it to the end of the function. - ev_loop_destroy() must be called after ipc_shutdown() because the latter calls ev_ functions. Fixes #3599
This commit is contained in:
parent
82a35a2418
commit
02bb2693f9
|
@ -13,10 +13,6 @@
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef I3_ASAN_ENABLED
|
|
||||||
#include <sanitizer/lsan_interface.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "shmlog.h"
|
#include "shmlog.h"
|
||||||
|
|
||||||
// Macros to make the YAJL API a bit easier to use.
|
// Macros to make the YAJL API a bit easier to use.
|
||||||
|
@ -1573,12 +1569,6 @@ void cmd_layout_toggle(I3_CMD, const char *toggle_mode) {
|
||||||
*/
|
*/
|
||||||
void cmd_exit(I3_CMD) {
|
void cmd_exit(I3_CMD) {
|
||||||
LOG("Exiting due to user command.\n");
|
LOG("Exiting due to user command.\n");
|
||||||
#ifdef I3_ASAN_ENABLED
|
|
||||||
__lsan_do_leak_check();
|
|
||||||
#endif
|
|
||||||
ipc_shutdown(SHUTDOWN_REASON_EXIT);
|
|
||||||
unlink(config.ipc_socket_path);
|
|
||||||
xcb_disconnect(conn);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
/* unreached */
|
/* unreached */
|
||||||
|
|
19
src/main.c
19
src/main.c
|
@ -161,13 +161,6 @@ void main_set_x11_cb(bool enable) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void i3_exit(void) {
|
static void i3_exit(void) {
|
||||||
/* We need ev >= 4 for the following code. Since it is not *that* important (it
|
|
||||||
* only makes sure that there are no i3-nagbar instances left behind) we still
|
|
||||||
* support old systems with libev 3. */
|
|
||||||
#if EV_VERSION_MAJOR >= 4
|
|
||||||
ev_loop_destroy(main_loop);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (*shmlogname != '\0') {
|
if (*shmlogname != '\0') {
|
||||||
fprintf(stderr, "Closing SHM log \"%s\"\n", shmlogname);
|
fprintf(stderr, "Closing SHM log \"%s\"\n", shmlogname);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
@ -175,6 +168,18 @@ static void i3_exit(void) {
|
||||||
}
|
}
|
||||||
ipc_shutdown(SHUTDOWN_REASON_EXIT);
|
ipc_shutdown(SHUTDOWN_REASON_EXIT);
|
||||||
unlink(config.ipc_socket_path);
|
unlink(config.ipc_socket_path);
|
||||||
|
xcb_disconnect(conn);
|
||||||
|
|
||||||
|
/* We need ev >= 4 for the following code. Since it is not *that* important (it
|
||||||
|
* only makes sure that there are no i3-nagbar instances left behind) we still
|
||||||
|
* support old systems with libev 3. */
|
||||||
|
#if EV_VERSION_MAJOR >= 4
|
||||||
|
ev_loop_destroy(main_loop);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef I3_ASAN_ENABLED
|
||||||
|
__lsan_do_leak_check();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue