From: Neil T. <nt...@us...> - 2006-09-04 14:24:38
|
Update of /cvsroot/pgsqlformac/pgCocoaDB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23394 Modified Files: ChangeLog Connection.m ExplorerModel.h ExplorerModel.m Field.m Log Message: Add retain to thread to fix crash. Index: ExplorerModel.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.m,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ExplorerModel.m 1 Sep 2006 00:53:35 -0000 1.15 --- ExplorerModel.m 4 Sep 2006 14:24:35 -0000 1.16 *************** *** 345,348 **** --- 345,349 ---- - (void)buildSchema:(id)anOutlineView { + [self retain]; // Make sure self does not dealloc while thread is running. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; ExplorerNode * newNode; *************** *** 355,364 **** if (schema == nil) { ! NSLog(@"Attempted to build Schema without proper init."); return; } ! [self setExplorerThreadStatus:1]; // set database level --- 356,366 ---- if (schema == nil) { ! NSLog(@"Schema init returned error."); ! [self setExplorerThreadStatus:Error]; return; } ! [self setExplorerThreadStatus:Running]; // set database level *************** *** 458,466 **** [rootNode autorelease]; rootNode = realRootNode; ! [self setExplorerThreadStatus:3]; [(NSOutlineView *)anOutlineView reloadData]; [schema release]; schema = nil; [pool release]; return; } --- 460,469 ---- [rootNode autorelease]; rootNode = realRootNode; ! [self setExplorerThreadStatus:Done]; [(NSOutlineView *)anOutlineView reloadData]; [schema release]; schema = nil; [pool release]; + [self release]; return; } Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ChangeLog,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ChangeLog 1 Sep 2006 00:53:35 -0000 1.20 --- ChangeLog 4 Sep 2006 14:24:35 -0000 1.21 *************** *** 1,2 **** --- 1,9 ---- + 2006-08-31 19:53 ntiffin + + * ChangeLog, Connection.h, Connection.m, ExplorerModel.h, + ExplorerModel.m, ExplorerNode.h, ExplorerNode.m, Schema.h, + Schema.m, UnitTest/pgCocoaDBSchemaTest.m: Fix for PGconn not + being thread safe. Migrate to new PQconnectdb API. + 2006-08-30 16:26 ntiffin Index: Connection.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Connection.m,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Connection.m 1 Sep 2006 00:53:35 -0000 1.16 --- Connection.m 4 Sep 2006 14:24:35 -0000 1.17 *************** *** 95,98 **** --- 95,99 ---- [self setErrorDescription:[NSString stringWithFormat:@"%s", PQerrorMessage(pgconn)]]; [self appendSQLLog:[NSMutableString stringWithFormat:@"Connection to database %@ Failed.\n", dbName]]; + [self appendSQLLog:[NSMutableString stringWithFormat:@"Connection string: %@\n\n", connectionString]]; PQfinish(pgconn); Index: Field.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Field.m,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Field.m 12 Aug 2006 16:38:16 -0000 1.4 --- Field.m 4 Sep 2006 14:24:35 -0000 1.5 *************** *** 57,61 **** - (NSString *)description { ! return [NSString stringWithFormat:@"%@ %@", name, value]; } --- 57,61 ---- - (NSString *)description { ! return [NSString stringWithFormat:@"'%@' '%@'", name, value]; } Index: ExplorerModel.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ExplorerModel.h 1 Sep 2006 00:53:35 -0000 1.6 --- ExplorerModel.h 4 Sep 2006 14:24:35 -0000 1.7 *************** *** 14,17 **** --- 14,18 ---- #import "PGCocoaDB.h" + enum thread_status { None, Running, Done, Error }; @interface ExplorerModel : NSObject *************** *** 28,32 **** NSLock *explorerThreadStatusLock; ! unsigned int explorerThreadStatus; // 0 = not inited, 1 = running, 2 = error, 3 = done, } --- 29,33 ---- NSLock *explorerThreadStatusLock; ! enum thread_status explorerThreadStatus; } |