mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 18:45:10 +00:00
Fix a small leak + some cleanup
This commit is contained in:
parent
c9334eb071
commit
375e21af07
12
src/conky.cc
12
src/conky.cc
@ -182,9 +182,7 @@ int top_cpu, top_mem, top_time;
|
|||||||
int top_io;
|
int top_io;
|
||||||
#endif
|
#endif
|
||||||
int top_running;
|
int top_running;
|
||||||
int output_methods;
|
|
||||||
static conky::simple_config_setting<bool> extra_newline("extra_newline", false, false);
|
static conky::simple_config_setting<bool> extra_newline("extra_newline", false, false);
|
||||||
enum x_initialiser_state x_initialised = NO;
|
|
||||||
static volatile int g_signal_pending;
|
static volatile int g_signal_pending;
|
||||||
|
|
||||||
/* Update interval */
|
/* Update interval */
|
||||||
@ -2491,11 +2489,6 @@ void clean_up_x11(void)
|
|||||||
XDestroyRegion(x11_stuff.region);
|
XDestroyRegion(x11_stuff.region);
|
||||||
x11_stuff.region = NULL;
|
x11_stuff.region = NULL;
|
||||||
}
|
}
|
||||||
if(display) {
|
|
||||||
XCloseDisplay(display);
|
|
||||||
display = NULL;
|
|
||||||
}
|
|
||||||
x_initialised = NO;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2517,11 +2510,10 @@ void clean_up_without_threads(void *memtofree1, void* memtofree2)
|
|||||||
|
|
||||||
free_and_zero(info.cpu_usage);
|
free_and_zero(info.cpu_usage);
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
if (x_initialised == YES) {
|
if(out_to_x.get(*state))
|
||||||
clean_up_x11();
|
clean_up_x11();
|
||||||
}else{
|
else
|
||||||
fonts.clear(); //in set_default_configurations a font is set but not loaded
|
fonts.clear(); //in set_default_configurations a font is set but not loaded
|
||||||
}
|
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
if (info.first_process) {
|
if (info.first_process) {
|
||||||
|
10
src/conky.h
10
src/conky.h
@ -319,16 +319,6 @@ extern conky::range_config_setting<unsigned int> max_user_text;
|
|||||||
/* path to config file */
|
/* path to config file */
|
||||||
extern std::string current_config;
|
extern std::string current_config;
|
||||||
|
|
||||||
#define TO_STDERR 4
|
|
||||||
|
|
||||||
enum x_initialiser_state {
|
|
||||||
NO = 0,
|
|
||||||
YES = 1,
|
|
||||||
NEVER = 2
|
|
||||||
};
|
|
||||||
extern int output_methods;
|
|
||||||
extern enum x_initialiser_state x_initialised;
|
|
||||||
|
|
||||||
#define DEFAULT_TEXT_BUFFER_SIZE_S "##DEFAULT_TEXT_BUFFER_SIZE"
|
#define DEFAULT_TEXT_BUFFER_SIZE_S "##DEFAULT_TEXT_BUFFER_SIZE"
|
||||||
|
|
||||||
#define NOBATTERY 0
|
#define NOBATTERY 0
|
||||||
|
10
src/x11.cc
10
src/x11.cc
@ -1036,13 +1036,13 @@ void get_x11_desktop_info(Display *current_display, Atom atom)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NOT_IN_X "Not running in X"
|
static const char NOT_IN_X[] = "Not running in X";
|
||||||
|
|
||||||
void print_monitor(struct text_object *obj, char *p, int p_max_size)
|
void print_monitor(struct text_object *obj, char *p, int p_max_size)
|
||||||
{
|
{
|
||||||
(void)obj;
|
(void)obj;
|
||||||
|
|
||||||
if(x_initialised != YES) {
|
if(not out_to_x.get(*state)) {
|
||||||
strncpy(p, NOT_IN_X, p_max_size);
|
strncpy(p, NOT_IN_X, p_max_size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1053,7 +1053,7 @@ void print_monitor_number(struct text_object *obj, char *p, int p_max_size)
|
|||||||
{
|
{
|
||||||
(void)obj;
|
(void)obj;
|
||||||
|
|
||||||
if(x_initialised != YES) {
|
if(not out_to_x.get(*state)) {
|
||||||
strncpy(p, NOT_IN_X, p_max_size);
|
strncpy(p, NOT_IN_X, p_max_size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1064,7 +1064,7 @@ void print_desktop(struct text_object *obj, char *p, int p_max_size)
|
|||||||
{
|
{
|
||||||
(void)obj;
|
(void)obj;
|
||||||
|
|
||||||
if(x_initialised != YES) {
|
if(not out_to_x.get(*state)) {
|
||||||
strncpy(p, NOT_IN_X, p_max_size);
|
strncpy(p, NOT_IN_X, p_max_size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1075,7 +1075,7 @@ void print_desktop_number(struct text_object *obj, char *p, int p_max_size)
|
|||||||
{
|
{
|
||||||
(void)obj;
|
(void)obj;
|
||||||
|
|
||||||
if(x_initialised != YES) {
|
if(not out_to_x.get(*state)) {
|
||||||
strncpy(p, NOT_IN_X, p_max_size);
|
strncpy(p, NOT_IN_X, p_max_size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user