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

Peter Bloomfield <[email protected]> Thu, 01 Aug 2019 20:10:46 -0400
Newsgroups gmane.comp.gnome.apps.balsa
Message-ID <[email protected]>
Hi Albrecht,

On 07/31/2019 08:17:11 AM Wed, Albrecht Dreß wrote:
> 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.

I've seen that myself, but never felt motivated to look for a fix :-)

I tested your patch and found no issues, but since it affects only IMAP mailboxes, I'd feel more comfortable with a more limited fix (see attached). The handling of view-filters seems to be very different between local mailboxes and IMAP.

What do you think?

Peter

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list
mailbox-imap.diff (text/x-patch, 463 B)
diff --git a/libbalsa/mailbox_imap.c b/libbalsa/mailbox_imap.c
index 106a92031..6f1dd5525 100644
--- a/libbalsa/mailbox_imap.c
+++ b/libbalsa/mailbox_imap.c
@@ -1173,6 +1173,8 @@ libbalsa_mailbox_imap_close(LibBalsaMailbox * mailbox, gboolean expunge)
     free_messages_info(mimap);
     libbalsa_mailbox_imap_release_handle(mimap);
     mimap->sort_field = -1;	/* Invalidate. */
+
+    libbalsa_mailbox_set_view_filter(mailbox, NULL, FALSE);
 }
 
 static FILE*
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQS030wPRfNNA5alz3MfX9S1uSp09QUCXUN/hgAKCRAfX9S1uSp0
9WMgAJ955Db/NzKBy3l1l59Gz9GnWKATnQCgjBOUsNCBdkCzvPzRoaWuaKzGfjo=
=uZTJ
-----END PGP SIGNATURE-----