[patch] xfce4-panel and SIGTERM

Adriano Winter Bess awbess at gmail.com
Mon Mar 20 19:12:16 CET 2006


On Sun, Mar 19, 2006 at 08:27:23PM +0100, Jasper Huijsmans wrote:
> Anyway, unfortunately I can't reproduce this. It works fine for me. I'll 
> keep looking...

The patch is attached and here is my trial to explain it -- I just hope it
doesn't seem like I'm trying to teach a fisher how to fish ;)

1. panel_app_run() (on panel-app.c) calls cleanup_panels() before exitting;
2. cleanup_panels() cleans up _first_ all monitors list and _second_ all panels;
3. during the clean up of panels in cleanup_panels(), panel_free_data() (in
   panel.c) is invoked;
4. panel_free_data() frees all items and gives some time for the plugins to
   exit. During this, it calls gtk_main_iteration();
5. gtk_main_iteration() process a pending size-allocate signal for the panel,
   which in turn tries to access the monitor list -- but the monitors have
   already been freed.

Unfortunatelly I don't know why is it that only on my system it seems to have
this pending signals which mess up everything (maybe my panels layout on
screen?).

The patch attached is quite simple: panels are cleaned up before the monitors,
so that if there's any pending signal to be processed, it will still find a
consistent monitor list. Of course I've tested it and the panel exits fine with
both SIGTERM and `xfce4-panel --exit' now.

Regards,
Adriano
-- 
Adriano Winter Bess

-------------- next part --------------
Index: panel/panel-app.c
===================================================================
--- panel/panel-app.c	(revis??o 20504)
+++ panel/panel-app.c	(c??pia de trabalho)
@@ -132,13 +132,6 @@
         l = g_list_delete_link (l, l);
     }
 
-    for (i = 0; i < panel_app.monitor_list->len; ++i)
-    {
-        XfceMonitor *xmon = g_ptr_array_index (panel_app.monitor_list, i);
-        g_free (xmon);
-    }
-    g_ptr_array_free (panel_app.monitor_list, TRUE);
-
     for (i = 0; i < panel_app.panel_list->len; ++i)
     {
         Panel *panel = g_ptr_array_index (panel_app.panel_list, i);
@@ -153,6 +146,13 @@
     }
 
     g_ptr_array_free (panel_app.panel_list, TRUE);
+
+    for (i = 0; i < panel_app.monitor_list->len; ++i)
+    {
+        XfceMonitor *xmon = g_ptr_array_index (panel_app.monitor_list, i);
+        g_free (xmon);
+    }
+    g_ptr_array_free (panel_app.monitor_list, TRUE);
 }
 
 /* signal handling */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20060320/eb5df586/attachment.pgp>


More information about the Xfce4-dev mailing list