oc: cached usercontext updates indexing_context
Instead of use always the one given on initializationpull/69/head
parent
52ad0e0e5b
commit
a7c2054cce
|
@ -42,6 +42,7 @@
|
|||
- (id) initForUsername: (NSString *) username
|
||||
withIndexing: (struct indexing_context *) indexing;
|
||||
|
||||
- (void) updateIndexing: (struct indexing_context *) indexing;
|
||||
|
||||
- (void) increaseUseCount;
|
||||
- (void) decreaseUseCount;
|
||||
|
|
|
@ -119,6 +119,11 @@ MAPIStoreMappingKeyFromId (uint64_t idNbr)
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void) updateIndexing: (struct indexing_context *) newIndexing
|
||||
{
|
||||
indexing = newIndexing;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[username release];
|
||||
|
|
|
@ -68,6 +68,8 @@
|
|||
- (id) initWithUsername: (NSString *) newUsername
|
||||
andTDBIndexing: (struct indexing_context *) indexing;
|
||||
|
||||
- (void) updateIndexing: (struct indexing_context *) indexing;
|
||||
|
||||
- (NSString *) username;
|
||||
- (SOGoUser *) sogoUser;
|
||||
|
||||
|
|
|
@ -65,7 +65,14 @@ static NSMapTable *contextsTable = nil;
|
|||
id userContext;
|
||||
|
||||
userContext = [contextsTable objectForKey: username];
|
||||
if (!userContext)
|
||||
if (userContext)
|
||||
{
|
||||
// The indexing_context used when this user context was created
|
||||
// could had been freed, so we have to update it and use the one
|
||||
// that we receive as parameter (which is a valid one for sure).
|
||||
[userContext updateIndexing: indexing];
|
||||
}
|
||||
else
|
||||
{
|
||||
userContext = [[self alloc] initWithUsername: username
|
||||
andTDBIndexing: indexing];
|
||||
|
@ -76,6 +83,11 @@ static NSMapTable *contextsTable = nil;
|
|||
return userContext;
|
||||
}
|
||||
|
||||
- (void) updateIndexing: (struct indexing_context *) indexing
|
||||
{
|
||||
[mapping updateIndexing: indexing];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
|
|
Loading…
Reference in New Issue