[balsa] main-window: Avoid recursive entry



commit 82db6b41c63de53f36911bd4547d8e876bfef6c0
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Jan 7 11:35:12 2020 -0500

    main-window: Avoid recursive entry
    
    to an idle callback. It happens because of a call to
    libbalsa_progress_set_fraction(), which then results in a call
    to gtk_main_iteration_do(); the current event is apparently
    still in the queue, so it gets re-entered.
    
    The progress indicator needs to be rethought!
    
    * src/main-window.c (bw_real_open_mbnode_idle_cb),
      (balsa_window_real_open_mbnode):

 ChangeLog         | 14 ++++++++++++++
 src/main-window.c |  7 +++++++
 2 files changed, 21 insertions(+)
---
diff --git a/ChangeLog b/ChangeLog
index d2ebc2708..2be82b1f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2020-01-07  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       main-window: Avoid recursive entry
+
+       to an idle callback. It happens because of a call to
+       libbalsa_progress_set_fraction(), which then results in a call
+       to gtk_main_iteration_do(); the current event is apparently
+       still in the queue, so it gets re-entered.
+
+       The progress indicator needs to be rethought!
+
+       * src/main-window.c (bw_real_open_mbnode_idle_cb),
+       (balsa_window_real_open_mbnode):
+
 2020-01-06  Peter Bloomfield  <pbloomfield bellsouth net>
 
        libbalsa-mailbox: Pack booleans in contiguous 1-bit fields
diff --git a/src/main-window.c b/src/main-window.c
index 46239d85a..0ca705f5f 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -2858,6 +2858,7 @@ typedef struct {
     gchar            *message;
     gboolean          set_current;
     GApplication     *application;
+    gboolean          opening;
 } BalsaWindowRealOpenMbnodeInfo;
 
 static gboolean
@@ -2882,6 +2883,11 @@ bw_real_open_mbnode_idle_cb(BalsaWindowRealOpenMbnodeInfo * info)
         return FALSE;
     }
 
+    /* Avoid recursive entry: */
+    if (info->opening)
+        return FALSE;
+    info->opening = TRUE;
+
     balsa_window_decrease_activity(window, info->message);
     g_object_remove_weak_pointer(G_OBJECT(window),
                                  (gpointer *) &info->window);
@@ -3031,6 +3037,7 @@ balsa_window_real_open_mbnode(BalsaWindow * window,
     info->set_current = set_current;
     info->index = index;
     info->message = message;
+    info->opening = FALSE;
 
     info->application = G_APPLICATION(gtk_window_get_application(GTK_WINDOW(window)));
     g_application_hold(info->application);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]