[Goodies-commits] r5259 - xfce4-mailwatch-plugin/trunk/libmailwatch-core

Brian Tarricone kelnos at xfce.org
Sat Aug 16 20:30:30 CEST 2008


Author: kelnos
Date: 2008-08-16 18:30:30 +0000 (Sat, 16 Aug 2008)
New Revision: 5259

Modified:
   xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-imap.c
Log:
fix folder tree thread quit on dialog close, etc.

Modified: xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-imap.c
===================================================================
--- xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-imap.c	2008-08-16 18:15:32 UTC (rev 5258)
+++ xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-imap.c	2008-08-16 18:30:30 UTC (rev 5259)
@@ -1238,8 +1238,7 @@
     XfceMailwatchIMAPMailbox *imailbox = user_data;
     
     imailbox->folder_tree_dialog = NULL;
-    
-    g_atomic_pointer_set(&imailbox->folder_tree_th, NULL);
+    g_atomic_int_set(&imailbox->folder_tree_running, FALSE);
 }
 
 static void
@@ -1359,6 +1358,14 @@
         gtk_window_present(GTK_WINDOW(imailbox->folder_tree_dialog));
         return;
     }
+
+    /* this should happen rarely, only if you're able to open the dialog,
+     * close it quickly while folders are still being fetched, and then
+     * quickly open it again before the original thread quits.  even then,
+     * delay should be minimal */
+    g_atomic_int_set(&imailbox->folder_tree_running, FALSE);
+    while(g_atomic_pointer_get(&imailbox->folder_tree_th))
+        g_thread_yield();
     
     if(!imailbox->host || !imailbox->username) {
         xfce_message_dialog(toplevel, _("Error"), GTK_STOCK_DIALOG_WARNING,




More information about the Goodies-commits mailing list