Merge pull request #202 from zentyal/ejhernandez/workaround-sync-configure-crash

Workaround sync configure crashes
This commit is contained in:
Jesús García Sáez committed 2015-11-09 11:34:29 +01:00
commit af413f2b32
2 files changed
+17 -2

No files matched your search

+8 -1
View File
@@ -599,7 +599,7 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
uint64_t lastModseqNbr;
EOQualifier *searchQualifier;
NSArray *uids, *changeNumbers;
NSUInteger count, max;
NSUInteger count, max, nFetched;
NSArray *fetchResults;
NSDictionary *result;
NSData *changeKey;
@@ -678,6 +678,13 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
= [fetchResults sortedArrayUsingFunction: _compareFetchResultsByMODSEQ
context: NULL];
nFetched = [fetchResults count];
if (nFetched != max) {
[self errorWithFormat: @"Error fetching UIDs. Asked: %d Received: %d."
@"Check the IMAP conversation for details", max, nFetched];
return NO;
}
for (count = 0; count < max; count++)
{
result = [fetchResults objectAtIndex: count];
@@ -604,8 +604,16 @@ static Class iCalEventK = nil;
NSNumber *classNumber;
unsigned int grantedCount;
iCalAccessClass currentClass;
WOContext *localContext;
[self initializeQuickTablesAclsInContext: context];
/* FIXME: The stored context from initialisation may have changed
by setContext by other operations in OpenChange library,
so we keep tighly to use the current session one. Without
this, the login is set to nil and a NSException is raised
at [SOGoAppointmentFolder:roleForComponentsWithAccessClass:forUser]
inside [SOGoAppointmentFolder:initializeQuickTablesAclsInContext]. */
localContext = [[WOApplication application] context];
[self initializeQuickTablesAclsInContext: localContext];
grantedClasses = [NSMutableArray arrayWithCapacity: 3];
deniedClasses = [NSMutableArray arrayWithCapacity: 3];
for (currentClass = 0;