]> git.sur5r.net Git - i3/i3/blobdiff - src/main.c
Merge pull request #3637 from i3/stapelberg-patch-1
[i3/i3] / src / main.c
index 4a20e0c0623552f935b00ed820ba76fe3e2c6360..0db5b44076a88c5e35bd54379409291122b8d820 100644 (file)
@@ -161,13 +161,6 @@ void main_set_x11_cb(bool enable) {
  *
  */
 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') {
         fprintf(stderr, "Closing SHM log \"%s\"\n", shmlogname);
         fflush(stderr);
@@ -175,6 +168,18 @@ static void i3_exit(void) {
     }
     ipc_shutdown(SHUTDOWN_REASON_EXIT);
     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
 }
 
 /*
@@ -515,7 +520,7 @@ int main(int argc, char *argv[]) {
 
     conn = xcb_connect(NULL, &conn_screen);
     if (xcb_connection_has_error(conn))
-        errx(EXIT_FAILURE, "Cannot open display\n");
+        errx(EXIT_FAILURE, "Cannot open display");
 
     sndisplay = sn_xcb_display_new(conn, NULL, NULL);