Correct cleanup() behaviour
This commit is contained in:
parent
ab350c86f7
commit
ed067579b9
10
bar.c
10
bar.c
|
@ -360,13 +360,21 @@ init (void)
|
||||||
void
|
void
|
||||||
cleanup (void)
|
cleanup (void)
|
||||||
{
|
{
|
||||||
|
if (fontset[FONT_MAIN].xcb_ft)
|
||||||
xcb_close_font (c, fontset[FONT_MAIN].xcb_ft);
|
xcb_close_font (c, fontset[FONT_MAIN].xcb_ft);
|
||||||
|
if (fontset[FONT_FALLBACK].xcb_ft)
|
||||||
xcb_close_font (c, fontset[FONT_FALLBACK].xcb_ft);
|
xcb_close_font (c, fontset[FONT_FALLBACK].xcb_ft);
|
||||||
|
if (canvas)
|
||||||
xcb_free_pixmap (c, canvas);
|
xcb_free_pixmap (c, canvas);
|
||||||
|
if (win)
|
||||||
xcb_destroy_window (c, win);
|
xcb_destroy_window (c, win);
|
||||||
|
if (draw_gc)
|
||||||
xcb_free_gc (c, draw_gc);
|
xcb_free_gc (c, draw_gc);
|
||||||
|
if (clear_gc)
|
||||||
xcb_free_gc (c, clear_gc);
|
xcb_free_gc (c, clear_gc);
|
||||||
|
if (underl_gc)
|
||||||
xcb_free_gc (c, underl_gc);
|
xcb_free_gc (c, underl_gc);
|
||||||
|
if (c)
|
||||||
xcb_disconnect (c);
|
xcb_disconnect (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,10 +413,10 @@ main (int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
atexit (cleanup);
|
||||||
signal (SIGINT, sighandle);
|
signal (SIGINT, sighandle);
|
||||||
signal (SIGTERM, sighandle);
|
signal (SIGTERM, sighandle);
|
||||||
init ();
|
init ();
|
||||||
atexit (cleanup);
|
|
||||||
|
|
||||||
/* Get the fd to Xserver */
|
/* Get the fd to Xserver */
|
||||||
pollin[1].fd = xcb_get_file_descriptor (c);
|
pollin[1].fd = xcb_get_file_descriptor (c);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user