fixed memory leak
git-svn-id: http://tint2.googlecode.com/svn/trunk@21 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
@@ -65,14 +65,15 @@ void add_task (Window win)
|
||||
new_tsk->title = 0;
|
||||
}
|
||||
if (new_tsk->icon_data) {
|
||||
XFree (new_tsk->icon_data);
|
||||
free (new_tsk->icon_data);
|
||||
new_tsk->icon_data = 0;
|
||||
}
|
||||
free(new_tsk);
|
||||
fprintf(stderr, "task on all desktop : ignored\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//printf("add_task %d %s\n", index(desktop, monitor), new_tsk->title);
|
||||
Taskbar *tskbar;
|
||||
tskbar = &panel.taskbar[index(desktop, monitor)];
|
||||
new_tsk->area.parent = tskbar;
|
||||
@@ -92,13 +93,14 @@ void remove_task (Task *tsk)
|
||||
tskbar->area.list = g_slist_remove(tskbar->area.list, tsk);
|
||||
resize_tasks (tskbar);
|
||||
redraw (&tskbar->area);
|
||||
//printf("remove_task %d %s\n", index(tskbar->desktop, tskbar->monitor), tsk->title);
|
||||
|
||||
if (tsk->title) {
|
||||
free (tsk->title);
|
||||
tsk->title = 0;
|
||||
}
|
||||
if (tsk->icon_data) {
|
||||
XFree (tsk->icon_data);
|
||||
free (tsk->icon_data);
|
||||
tsk->icon_data = 0;
|
||||
}
|
||||
XFreePixmap (server.dsp, tsk->area.pmap);
|
||||
|
||||
@@ -66,14 +66,17 @@ void task_refresh_tasklist ()
|
||||
|
||||
nb = panel.nb_desktop * panel.nb_monitor;
|
||||
for (i=0 ; i < nb ; i++) {
|
||||
for (l0 = panel.taskbar[i].area.list; l0 ; l0 = l0->next) {
|
||||
l0 = panel.taskbar[i].area.list;
|
||||
while (l0) {
|
||||
tsk = l0->data;
|
||||
|
||||
l0 = l0->next;
|
||||
|
||||
if (tsk->win == active_win) panel.task_active = tsk;
|
||||
|
||||
for (j = 0; j < num_results; j++) {
|
||||
if (tsk->win == win[j]) break;
|
||||
}
|
||||
// careful : remove_task change l0->next
|
||||
if (tsk->win != win[j]) remove_task (tsk);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user