[balsa: 2/3] mailbox: Warn in dispose if open_refs != 0



commit 06dd11f81f77f549314b7513bdae7250e6dd055c
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Feb 11 11:54:45 2020 -0500

    mailbox: Warn in dispose if open_refs != 0
    
    In libbalsa_mailbox_dispose(), if open_refs >0, we repeatedly close the
    mailbox until it is zero. We must warn if that kludge is actually used.

 libbalsa/mailbox.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index d635006d9..515a53382 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -294,8 +294,12 @@ libbalsa_mailbox_dispose(GObject * object)
     LibBalsaMailbox *mailbox = LIBBALSA_MAILBOX(object);
     LibBalsaMailboxPrivate *priv = libbalsa_mailbox_get_instance_private(mailbox);
 
-    while (priv->open_ref > 0)
-        libbalsa_mailbox_close(mailbox, FALSE);
+    if (priv->open_ref != 0) {
+        g_warning("%s %s open_ref (%d) != 0", __func__, priv->name, priv->open_ref);
+
+        while (priv->open_ref > 0)
+            libbalsa_mailbox_close(mailbox, FALSE);
+    }
 
     G_OBJECT_CLASS(libbalsa_mailbox_parent_class)->dispose(object);
 }


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