From d8f38f5740abe258fbcf339c6a666415e67feb57 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Mon, 29 Mar 2010 14:22:37 +0000 Subject: =?UTF-8?q?=E2=80=A2=20added=20some=20more=20sanity=20checks=20to?= =?UTF-8?q?=20avoid=20exceptions=20due=20to=20threading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Frameworks/MCPKit') diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index 683cda7d..c4d41778 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -1877,10 +1877,16 @@ void performThreadedKeepAlive(void *ptr) connectionID = @"_"; // Re-init with already cached data from navigator controller + NSDictionary *dbstructure = [[[self delegate] getDbStructure] retain]; [structure removeAllObjects]; - [structure setObject:[NSMutableDictionary dictionaryWithDictionary:[[self delegate] getDbStructure]] forKey:connectionID]; - [allKeysofDbStructure removeAllObjects]; - [allKeysofDbStructure addObjectsFromArray:[[self delegate] allSchemaKeys]]; + [structure setObject:[NSMutableDictionary dictionaryWithDictionary:dbstructure] forKey:connectionID]; + NSArray *allStructureKeys = [[[self delegate] allSchemaKeys] retain]; + if(allStructureKeys && [allStructureKeys count]) { + [allKeysofDbStructure removeAllObjects]; + [allKeysofDbStructure addObjectsFromArray:allStructureKeys]; + } + if(allStructureKeys) [allStructureKeys release], allStructureKeys = nil; + if(dbstructure) [dbstructure release], dbstructure = nil; BOOL removeAddFlag = NO; -- cgit v1.2.3