melib: drop MutexGuard before calling add_path_to_index

In some cases add_path_to_index was called with the mutex already held,
and a deadlock occurred.
embed
Manos Pitsidianakis 2019-05-09 23:11:57 +03:00
parent d231865f88
commit 13fba8d35b
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 9 additions and 0 deletions

View File

@ -229,6 +229,11 @@ impl MailBackend for MaildirType {
} else {
/* Did we just miss a Create event? In any case, create
* envelope. */
/* Drop the lock manually as add_path_to_index would deadlock
* */
drop(index_lock);
drop(hash_indexes_lock);
if let Some(env) = add_path_to_index(
&hash_indexes,
folder_hash,
@ -311,6 +316,10 @@ impl MailBackend for MaildirType {
.unwrap()
.to_path_buf();
debug!("filename = {:?}", file_name);
/* Drop the lock manually as add_path_to_index would deadlock
* */
drop(index_lock);
drop(hash_indexes_lock);
if let Some(env) = add_path_to_index(
&hash_indexes,
folder_hash,