Locks and more locks
* src/mail.cpp (mail_map_lock, uid_map_lock): New locks. (Mail::Mail, Mail::~Mail, Mail::get_mail_for_item), (Mail::get_mail_for_uuid, Mail::is_valid_ptr), (Mail::close_all_mails, Mail::revert_all_mails), (Mail::revert_all_mails, Mail::wipe_all_mails), (Mail::set_uuid, Mail::locate_all_crypto_recipients) (Mail::delete_lock, Mail::delete_unlock): New helpers to ensure a mail pointer stays valid. * src/mail.h: Update accordingly.
As the mail object is used from more and more threads
and will soon be used even more for autoencryption
we have to be _very_ careful to minimize / remove race
conditions which could lead to a crash.
For autoencryption we will have async code working
on every new mail.
Prepares:
- GnuPG-Bug-Id: T3999