1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-04 13:08:31 +00:00

Fix segfault in X11-related code

Conky sometimes tries to clears part of a window before it's created,
this breaks closing the displaying. For example with this config:
TEXT
$lua
This commit is contained in:
Nikolas Garofil 2009-11-21 15:45:00 +01:00
parent b85b0d5aab
commit 567a86f99a
3 changed files with 9 additions and 4 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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,