diff --git a/src/conky.c b/src/conky.c index 551bfb7e..e4689a38 100644 --- a/src/conky.c +++ b/src/conky.c @@ -3987,10 +3987,12 @@ void clean_up(void *memtofree1, void* memtofree2) } #ifdef X11 if (x_initialised == YES) { - XClearArea(display, window.window, text_start_x - window.border_inner_margin - window.border_outer_margin - window.border_width, - text_start_y - window.border_inner_margin - window.border_outer_margin - window.border_width, - text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, - text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, 0); + if(window_created == 1) { + XClearArea(display, window.window, text_start_x - window.border_inner_margin - window.border_outer_margin - window.border_width, + text_start_y - window.border_inner_margin - window.border_outer_margin - window.border_width, + text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, + text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, 0); + } destroy_window(); free_fonts(); if(x11_stuff.region) { diff --git a/src/x11.c b/src/x11.c index e61c6841..f9cf35a2 100644 --- a/src/x11.c +++ b/src/x11.c @@ -64,6 +64,7 @@ int workarea[4]; /* Window stuff */ struct conky_window window; +char window_created = 0; /* local prototypes */ static void update_workarea(void); @@ -215,6 +216,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour, * happens but I bet the bug is somewhere here. */ set_transparent = set_trans; background_colour = back_colour; + window_created = 1; #ifdef OWN_WINDOW if (own_window) { diff --git a/src/x11.h b/src/x11.h index 8c89f3bb..e339f0c2 100644 --- a/src/x11.h +++ b/src/x11.h @@ -83,6 +83,7 @@ extern int screen; extern int workarea[4]; extern struct conky_window window; +extern char window_created; void init_X11(const char*); void init_window(int use_own_window, int width, int height, int set_trans,