*fix* valgrind invalid read/write and memleaks
git-svn-id: http://tint2.googlecode.com/svn/trunk@572 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
1161b0921b
commit
eae7223ddf
6 changed files with 33 additions and 16 deletions
|
@ -78,6 +78,7 @@ void cleanup_clock()
|
|||
if (time_tooltip_timezone) g_free(time_tooltip_timezone);
|
||||
if (clock_lclick_command) g_free(clock_lclick_command);
|
||||
if (clock_rclick_command) g_free(clock_rclick_command);
|
||||
if (clock_timeout) stop_timeout(clock_timeout);
|
||||
}
|
||||
|
||||
|
||||
|
|
38
src/config.c
38
src/config.c
|
@ -375,10 +375,13 @@ void add_entry (char *key, char *value)
|
|||
else if (strcmp (key, "time1_format") == 0) {
|
||||
if (new_config_file == 0) {
|
||||
clock_enabled = 1;
|
||||
if (panel_items_order)
|
||||
panel_items_order = strcat(panel_items_order, "C");
|
||||
if (panel_items_order) {
|
||||
char* tmp = g_strconcat(panel_items_order, "C", NULL);
|
||||
g_free( panel_items_order );
|
||||
panel_items_order = tmp;
|
||||
}
|
||||
else
|
||||
panel_items_order = strdup("C");
|
||||
panel_items_order = g_strdup("C");
|
||||
}
|
||||
if (strlen(value) > 0) {
|
||||
time1_format = strdup (value);
|
||||
|
@ -658,10 +661,13 @@ void add_entry (char *key, char *value)
|
|||
if (new_config_file == 0) {
|
||||
systray_enabled = atoi(value);
|
||||
if (systray_enabled) {
|
||||
if (panel_items_order)
|
||||
panel_items_order = strcat(panel_items_order, "S");
|
||||
else
|
||||
panel_items_order = strdup("S");
|
||||
if (panel_items_order) {
|
||||
char* tmp = g_strconcat(panel_items_order, "S", NULL);
|
||||
g_free( panel_items_order );
|
||||
panel_items_order = tmp;
|
||||
}
|
||||
else
|
||||
panel_items_order = g_strdup("S");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -669,10 +675,13 @@ void add_entry (char *key, char *value)
|
|||
if (new_config_file == 0) {
|
||||
battery_enabled = atoi(value);
|
||||
if (battery_enabled) {
|
||||
if (panel_items_order)
|
||||
panel_items_order = strcat(panel_items_order, "B");
|
||||
else
|
||||
panel_items_order = strdup("B");
|
||||
if (panel_items_order) {
|
||||
char* tmp = g_strconcat(panel_items_order, "B", NULL);
|
||||
g_free( panel_items_order );
|
||||
panel_items_order = tmp;
|
||||
}
|
||||
else
|
||||
panel_items_order = g_strdup("B");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -753,11 +762,12 @@ int config_read_file (const char *path)
|
|||
if (new_config_file == 0) {
|
||||
taskbar_enabled = 1;
|
||||
if (panel_items_order) {
|
||||
char *tmp = strdup("T");
|
||||
panel_items_order = strcat(tmp, panel_items_order);
|
||||
char* tmp = g_strconcat( "T", panel_items_order, NULL );
|
||||
g_free(panel_items_order);
|
||||
panel_items_order = tmp;
|
||||
}
|
||||
else
|
||||
panel_items_order = strdup("T");
|
||||
panel_items_order = g_strdup("T");
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -303,7 +303,7 @@ void get_monitors()
|
|||
i++;
|
||||
}
|
||||
next:
|
||||
for (j=i; j<server.nb_monitor; ++j)
|
||||
for (j=i; j<nbmonitor; ++j)
|
||||
if (server.monitor[j].names)
|
||||
g_strfreev(server.monitor[j].names);
|
||||
server.nb_monitor = i;
|
||||
|
|
|
@ -532,6 +532,11 @@ void systray_render_icon_now(void* t)
|
|||
// we made also sure, that we always have a 32 bit visual, i.e. we can safely create 32 bit pixmaps here
|
||||
TrayWindow* traywin = t;
|
||||
traywin->render_timeout = 0;
|
||||
if ( traywin->width == 0 || traywin->height == 0 ) {
|
||||
// reschedule rendering since the geometry information has not yet been processed (can happen on slow cpu)
|
||||
systray_render_icon(traywin);
|
||||
return;
|
||||
}
|
||||
|
||||
// good systray icons support 32 bit depth, but some icons are still 24 bit.
|
||||
// We create a heuristic mask for these icons, i.e. we get the rgb value in the top left corner, and
|
||||
|
|
|
@ -156,7 +156,6 @@ void init_X11()
|
|||
|
||||
void cleanup()
|
||||
{
|
||||
cleanup_timeout();
|
||||
cleanup_systray();
|
||||
cleanup_tooltip();
|
||||
cleanup_clock();
|
||||
|
@ -174,6 +173,7 @@ void cleanup()
|
|||
imlib_context_disconnect_display();
|
||||
|
||||
cleanup_server();
|
||||
cleanup_timeout();
|
||||
if (server.dsp) XCloseDisplay(server.dsp);
|
||||
}
|
||||
|
||||
|
|
|
@ -398,6 +398,7 @@ void remove_from_multi_timeout(timeout* t)
|
|||
|
||||
if (g_slist_length(mth->timeout_list) == 1) {
|
||||
timeout* last_timeout = mth->timeout_list->data;
|
||||
g_slist_remove(mth->timeout_list, last_timeout);
|
||||
free(last_timeout->multi_timeout);
|
||||
last_timeout->multi_timeout = 0;
|
||||
g_hash_table_remove(multi_timeouts, last_timeout);
|
||||
|
|
Loading…
Reference in a new issue