From 82fb03b67b7106aea8b489e21b03225bcb761faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20J=2E=20Hern=C3=A1ndez=20Blasco?= Date: Wed, 25 Mar 2015 16:53:42 +0100 Subject: [PATCH] oc-mail: Ensure we are creating folder to the right user As it happened with dba17fb if we interleave requests from different users while creating a folder we can create the folder in other user's mailbox as latest activeUser is the one from latest sogo_context_get_root_folder call. This is for me a lack of right design and a workaround only fixing this issue but not the root cause. --- OpenChange/MAPIStoreMailFolder.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenChange/MAPIStoreMailFolder.m b/OpenChange/MAPIStoreMailFolder.m index ba2339586..72f909d2a 100644 --- a/OpenChange/MAPIStoreMailFolder.m +++ b/OpenChange/MAPIStoreMailFolder.m @@ -179,6 +179,12 @@ static Class SOGoMailFolderK, MAPIStoreMailFolderK, MAPIStoreOutboxFolderK; { nameInContainer = [NSString stringWithFormat: @"folder%@", [[folderName stringByEncodingImap4FolderName] asCSSIdentifier]]; + + /* it may be the operation is interleaved with operations + from other users having cached information in the thread + with the other user, so it'd better activate the user again here... */ + [[self userContext] activateWithUser: [[[self userContext] woContext] activeUser]]; + newFolder = [SOGoMailFolderK objectWithName: nameInContainer inContainer: sogoObject]; if ([newFolder create])