Two routines have to be replaced by the following version:
The bug was to not retain the connection object before removing from the pool. This could result in an immediate release of the object, provoking a SIG on calling [result autorelease].Two routines have to be replaced by the following version:
+ (PostgreSQL *)newPostgreSQLConnection
{
PostgreSQL *result = nil ;
if ([gFreePool count] > 0) {
result = [[gFreePool lastObject] retain] ;
[gFreePool removeLastObject] ;
}
else {
result = [[PostgreSQL alloc] init] ;
}
return [result autorelease] ;
}
- (PostgreSQL *)clone:(int *)resultCode
{
*resultCode = 0 ;
if (_debugMode)
NSAssert(_conn != nil, nilConnectionMsg) ;
if (_conn == nil)
return nil ;
PostgreSQL *conn = [PostgreSQL newPostgreSQLConnection] ; // autoreleased object
if ([conn connectToDatabase:[self databaseName] onHost:[self hostName] login:[self loginName] password:[self password] return:resultCode])
return conn ;
[PostgreSQL releasePostgreSQLConnection:conn] ;
return nil ;
}
In the embedded P3CCocoaExtensions framework, the NSString extensions source file contains a mispelled routine name and a bug in
stringByReplacingString
. The patch contains the complete source code of NSString-P3CExtensions (h and m), replace the old version by this one and recompile the framework.