+ if (restore_conn != NULL) {
+ /* This is not the initial connect, but a reconnect, most likely
+ * because our X11 connection was killed (e.g. by a user with xkill. */
+ ev_io_stop(main_loop, xcb_watcher);
+ ev_check_stop(main_loop, xcb_check);
+ ev_prepare_stop(main_loop, xcb_prepare);
+
+ placeholder_state *state;
+ while (!TAILQ_EMPTY(&state_head)) {
+ state = TAILQ_FIRST(&state_head);
+ TAILQ_REMOVE(&state_head, state, state);
+ free(state);
+ }
+
+ free(restore_conn);
+ free(xcb_watcher);
+ free(xcb_check);
+ free(xcb_prepare);
+ }
+