Author: rfm
Date: Mon Jul  7 18:25:16 2014
New Revision: 37986

URL: http://svn.gna.org/viewcvs/gnustep?rev=37986&view=rev
Log:
pool retain/release fixes

Modified:
    libs/sqlclient/trunk/SQLClientPool.m
    libs/sqlclient/trunk/testPostgres.m

Modified: libs/sqlclient/trunk/SQLClientPool.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClientPool.m?rev=37986&r1=37985&r2=37986&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClientPool.m        (original)
+++ libs/sqlclient/trunk/SQLClientPool.m        Mon Jul  7 18:25:16 2014
@@ -97,11 +97,8 @@
     {
       for (i = 0; i < count; i++)
         {
-          if (YES == used[i])
-            {
-              [clients[i] _clearPool: self];
-            }
-          else
+          [clients[i] _clearPool: self];
+          if (NO == used[i])
             {
               [clients[i] release];
             }
@@ -260,6 +257,10 @@
     }
   u[found] = YES;
   [lock unlockWithCondition: cond];
+  if (_debugging > 2)
+    {
+      NSLog(@"%@ provides %p", self, c[found]);
+    }
   return [c[found] autorelease];
 }
 
@@ -340,11 +341,8 @@
           while (max > maxConnections)
             {
               max--;
-              if (YES == u[max])
-                {
-                  [c[max] _clearPool: self];
-                }
-              else
+              [c[max] _clearPool: self];
+              if (NO == u[max])
                 {
                   [c[max] release];
                 }
@@ -416,11 +414,21 @@
       if (YES == u[index] && client == c[index])
         {
           u[index] = NO;
-          [c[index] retain];
           found = YES;
         }
     }
   [self _unlock];
+  if (_debugging > 2)
+    {
+      if (YES == found)
+        {
+          NSLog(@"%@ swallows %p", self, client);
+        }
+      else
+        {
+          NSLog(@"%@ rejects %p", self, client);
+        }
+    }
   return found;
 }
 

Modified: libs/sqlclient/trunk/testPostgres.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/testPostgres.m?rev=37986&r1=37985&r2=37986&view=diff
==============================================================================
--- libs/sqlclient/trunk/testPostgres.m (original)
+++ libs/sqlclient/trunk/testPostgres.m Mon Jul  7 18:25:16 2014
@@ -75,15 +75,22 @@
                                                  min: 1] autorelease];
 #if 0
 {
-  NSAutoreleasePool     *p = [NSAutoreleasePool new];
+  NSAutoreleasePool     *p;
   SQLClient             *c0;
   SQLClient             *c1;
 
   [sp setDebugging: 2];
+  p = [NSAutoreleasePool new];
   c0 = [sp provideClient];
   c1 = [sp provideClient];
+  [sp provideClientBeforeDate: [NSDate dateWithTimeIntervalSinceNow: 15.0]];
+  [p release];
+  p = [NSAutoreleasePool new];
+  c0 = [sp provideClient];
+  c1 = [sp provideClient];
+  [sp provideClientBeforeDate: [NSDate dateWithTimeIntervalSinceNow: 15.0]];
+  [p release];
   [sp provideClientBeforeDate: [NSDate dateWithTimeIntervalSinceNow: 25.0]];
-  [p release];
 }
 #endif
   db = [sp provideClient];


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to