Author: rfm
Date: Tue Nov 3 22:56:09 2015
New Revision: 39136
URL: http://svn.gna.org/viewcvs/gnustep?rev=39136&view=rev
Log:
retain/release fix
Modified:
libs/sqlclient/trunk/SQLClient.m
libs/sqlclient/trunk/SQLClientPool.m
Modified: libs/sqlclient/trunk/SQLClient.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClient.m?rev=39136&r1=39135&r2=39136&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClient.m (original)
+++ libs/sqlclient/trunk/SQLClient.m Tue Nov 3 22:56:09 2015
@@ -86,7 +86,7 @@
static Class SQLClientClass = Nil;
@interface SQLClientPool (Swallow)
-- (BOOL) _swallowClient: (SQLClient*)client withRetain: (BOOL)shouldRetain;
+- (BOOL) _swallowClient: (SQLClient*)client explicit: (BOOL)swallowed;
@end
@interface SQLTransaction (Creation)
+ (SQLTransaction*) _transactionUsing: (id)clientOrPool
@@ -2067,7 +2067,7 @@
{
if (nil != _pool)
{
- [_pool _swallowClient: self withRetain: NO];
+ [_pool _swallowClient: self explicit: NO];
}
else
{
Modified: libs/sqlclient/trunk/SQLClientPool.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClientPool.m?rev=39136&r1=39135&r2=39136&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClientPool.m (original)
+++ libs/sqlclient/trunk/SQLClientPool.m Tue Nov 3 22:56:09 2015
@@ -780,7 +780,7 @@
return s;
}
-- (BOOL) _swallowClient: (SQLClient*)client withRetain: (BOOL)shouldRetain
+- (BOOL) _swallowClient: (SQLClient*)client explicit: (BOOL)swallowed
{
BOOL found = NO;
int index;
@@ -812,15 +812,17 @@
if (_items[index].u > 0 && client == _items[index].c)
{
found = YES;
- if (YES == shouldRetain)
- {
- NSIncrementExtraRefCount(client);
- if (NSNotFound == _items[index].u)
+ if (YES == swallowed)
+ {
+ if (NSNotFound == _items[index].u || 1 == _items[index].u)
{
- /* This was exclusively owned, so now it must not be
- * owned by any thread.
+ /* This was only provided once, and has been explicitly
+ * swallowed by the pool again, so we should increment
+ * the reference count to prevent an implicit swallow
+ * caused by deallocation.
*/
_items[index].u = 0;
+ NSIncrementExtraRefCount(client);
}
else
{
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs