Diffusion GpgOL 7eed3c4c5e9f

Fix strange crash in recipient lookup

Authored by aheinecke on Apr 24 2018, 8:37 AM.

Description

Fix strange crash in recipient lookup

* src/mail.cpp (Mail::locate_keys): Add reentrancy guard.

The strangest thing seems to happen here:
In get_recipients the lookup for "AddressEntry" on
an unresolved address might cause network traffic.

So Outlook somehow "detaches" this call and keeps
processing window messages while the call is running.

So our do_delayed_locate might trigger a second locate.
If we access the OOM in this call while we access the
same object in the blocked "detached" call we crash.
(T3931)

After the window message is handled outlook retunrs
in the original lookup.

A better fix here might be a non recursive lock
of the OOM. But I expect that if we lock the handling
of the Windowmessage we might deadlock.

This also might be a cause for the crashes which caused