]> Dogcows Code - chaz/tint2/commitdiff
*fix* segfault fixed when removing last desktop and we've been on last desktop
authorAndreas Fink <andreas.fink85@googlemail.com>
Tue, 29 Dec 2009 22:04:24 +0000 (22:04 +0000)
committerAndreas Fink <andreas.fink85@googlemail.com>
Tue, 29 Dec 2009 22:04:24 +0000 (22:04 +0000)
src/taskbar/task.c
src/tint.c

index 81d4edad3361944e12eb665af57969b2bba567d6..191394ca30da5f4635d27fc38d61b4cb82641f96 100644 (file)
@@ -75,6 +75,7 @@ Task *add_task (Window win)
        Taskbar *tskbar;
        Task *new_tsk2=0;
        int i, j;
+       // QUESTION: Do we need to iterate over nb_panel (we know the monitor, why not taking panel1[monitor]???
        for (i=0 ; i < nb_panel ; i++) {
                for (j=0 ; j < panel1[i].nb_desktop ; j++) {
                        if (new_tsk.desktop != ALLDESKTOP && new_tsk.desktop != j) continue;
index bb7586d6f4f72f69dc1a3ad3feb887688221f143..cdb72a88cfa70751b525e927e21895c6aec783a1 100644 (file)
@@ -411,8 +411,11 @@ void event_property_notify (XEvent *e)
                                Panel *panel = &panel1[i];
                                if (panel_mode == MULTI_DESKTOP && panel->g_taskbar.use_active) {
                                        // redraw both taskbar
-                                       panel->taskbar[old_desktop].area.is_active = 0;
-                                       panel->taskbar[old_desktop].area.resize = 1;
+                                       if (server.nb_desktop > old_desktop) {
+                                               // can happen if last desktop is deleted and we've been on the last desktop
+                                               panel->taskbar[old_desktop].area.is_active = 0;
+                                               panel->taskbar[old_desktop].area.resize = 1;
+                                       }
                                        panel->taskbar[server.desktop].area.is_active = 1;
                                        panel->taskbar[server.desktop].area.resize = 1;
                                        panel_refresh = 1;
@@ -421,13 +424,15 @@ void event_property_notify (XEvent *e)
                                Taskbar *tskbar;
                                Task *tsk;
                                GSList *l;
-                               tskbar = &panel->taskbar[old_desktop];
-                               for (l = tskbar->area.list; l ; l = l->next) {
-                                       tsk = l->data;
-                                       if (tsk->desktop == ALLDESKTOP) {
-                                               tsk->area.on_screen = 0;
-                                               tskbar->area.resize = 1;
-                                               panel_refresh = 1;
+                               if (server.nb_desktop > old_desktop) {
+                                       tskbar = &panel->taskbar[old_desktop];
+                                       for (l = tskbar->area.list; l ; l = l->next) {
+                                               tsk = l->data;
+                                               if (tsk->desktop == ALLDESKTOP) {
+                                                       tsk->area.on_screen = 0;
+                                                       tskbar->area.resize = 1;
+                                                       panel_refresh = 1;
+                                               }
                                        }
                                }
                                tskbar = &panel->taskbar[server.desktop];
@@ -710,6 +715,7 @@ int main (int argc, char *argv[])
                if (panel_refresh) {
                        panel_refresh = 0;
 
+                       // QUESTION: do we need this first refresh_systray, because we check refresh_systray once again later...
                        if (refresh_systray) {
                                panel = (Panel*)systray.area.panel;
                                XSetWindowBackgroundPixmap (server.dsp, panel->main_win, None);
This page took 0.024 seconds and 4 git commands to generate.