[Bug + Fix?] Clear serach filter when an IMAP mailbox is closed

Albrecht Dreß <[email protected]> Wed, 31 Jul 2019 14:17:11 +0200
Newsgroups gmane.comp.gnome.apps.balsa
Message-ID <[email protected]>
Hi all,

I noticed that an IMAP search filter is not removed when closing the mailbox.  To reproduce:
1. open an IMAP mailbox
2. enter a string in the search entry, so that only some messages are displayed
3. close the mailbox
4. re-open the mailbox

After step 4, the search entry is empty, but only the messages as selected by the value given is step 2 are visible, ehich is confusing.  Afaict, this effect does not happen with MBox or Maildir mailboxes.

Running Balsa in the debugger, I /think/ this is caused by not clearing the priv->view_filter item of the mailbox when it is closed.  The attached simple two-liner patch fixes this for IMAP.  It /seems/ as if does not have any advert effect on other mailboxes, but as I do not fully understand what happens it would be great if someone could double-check it.

Best,
Albrecht.

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list
imap-clear-filter-on-close.diff (text/x-patch, 461 B)
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index 70deec935..e66d512a8 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -644,6 +644,8 @@ libbalsa_mailbox_close(LibBalsaMailbox * mailbox, gboolean expunge)
         libbalsa_mailbox_free_mindex(mailbox);
         priv->stamp++;
 	priv->state = LB_MAILBOX_STATE_CLOSED;
+	libbalsa_condition_unref(priv->view_filter);
+	priv->view_filter = NULL;
     }
 
     libbalsa_unlock_mailbox(mailbox);
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEcCEPemLFTtyGf4zATKlvDmfn2fgFAl1BhscACgkQTKlvDmfn
2fgJVwgApYHLKIm7PJ15ZfuyXEwB3pA9wIIyRy1bepjKqcY5iuSpNEHxCsPP9Zag
y55CiytrXNS7X55dn9PbvMTLGzZBoH277WMqqMZsnifFsh49ecHXnYOczeD1Of36
Zm2qIufUeElsvndniFyAQSIv/WdfQhTGNG4Dm0oWgF1P+899WpQf8xwDt7fGTW3a
Ezf54dq7SrqgdSlDE/NQhDxkL6Nj10W5EkIsTAiZW5KnWbQkYjxT8s2y8ureOBOR
WhxAYVYvTj0tZdiNCpRQJLPfgrLgnpYNqaboht2y7zHPHUrFtpotqnyoCXYOBAUW
OgG+0rgnpzYx97xxqR4W7tQlKoF9lQ==
=YMtO
-----END PGP SIGNATURE-----