[Users] [pull request] Fix crashes due to lack of synchronization with the IMAP thread

Jakub KiciƄski moorray3 at wp.pl
Fri Dec 19 02:42:20 CET 2014


On Thu, 18 Dec 2014 19:02:28 +0100, Michael Rasmussen wrote:
> On Thu, 18 Dec 2014 12:44:44 +0000 Brian Morrison <bdm at fenrir.org.uk> wrote:
> > 
> > Much appreciated too, although I don't see too many IMAP issues
> > anything that improves the robustness of Claws is a good thing.
>
> The more I study this patch the more I am convinced that this bug was
> the sole reason to my failing implementation of IMAP IDLE. When ever I
> did something in the GUI which caused a change of focus from one
> account to another or when the implementation did the required refresh
> every 29 minuts the IDLE thread would crash and hang forever if focus
> was changed from the account which open an IDLE thread last.

Well, I think the way the IMAP threading is implemented right now is
*really* fragile.  The GUI thread dispatches some work to the worker
and then it runs the event loop waiting for the worker to finish...
with a stack full of local pointers/local variables which can get
stale at any point!

I didn't get much exposure to GTK and especially it's threading model
but I'm inclined to think it's not what imap-thread.c looks like.
It can crash in so many weird and surprising ways that if anyone is
considering doing serious work on IMAP it may actually save you time
to fix the threading first instead of dealing with all the strange
bugs. It may be quite a bit of work though, like a full rewrite but
still - better than deciphering random use-after-free conditions.

Sorry for criticising the code. I don't want you to get the impression
that I fixed all the issues, my patch is more of a workaround actually.

	-- kuba



More information about the Users mailing list