+void
+shutdown_cleanup(void)
+{
+ int i, num_screens;
+
+ /* disable alarm because the following code may not be interrupted */
+ alarm(0);
+ if (signal(SIGALRM, SIG_IGN) == SIG_ERR)
+ err(1, "can't disable alarm");
+
+ bar_extra_stop();
+ bar_extra = 1;
+ unmap_all();
+
+ teardown_ewmh();
+
+ num_screens = xcb_setup_roots_length(xcb_get_setup(conn));
+ for (i = 0; i < num_screens; ++i) {
+ if (screens[i].bar_gc != 0)
+ xcb_free_gc(conn, screens[i].bar_gc);
+ if (!bar_font_legacy)
+ XftColorFree(display, DefaultVisual(display, i),
+ DefaultColormap(display, i), &bar_font_color);
+ }
+
+ if (bar_font_legacy)
+ XFreeFontSet(display, bar_fs);
+ else {
+ XftFontClose(display, bar_font);
+ }
+
+ xcb_key_symbols_free(syms);
+ xcb_flush(conn);
+ xcb_disconnect(conn);
+}
+