Author: rfm
Date: Wed Jul 13 12:51:29 2016
New Revision: 39996

URL: http://svn.gna.org/viewcvs/gnustep?rev=39996&view=rev
Log:
fix logic error in case where we have a nil date supplied

Modified:
    libs/base/trunk/Source/NSRunLoop.m

Modified: libs/base/trunk/Source/NSRunLoop.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSRunLoop.m?rev=39996&r1=39995&r2=39996&view=diff
==============================================================================
--- libs/base/trunk/Source/NSRunLoop.m  (original)
+++ libs/base/trunk/Source/NSRunLoop.m  Wed Jul 13 12:51:29 2016
@@ -1282,25 +1282,31 @@
   _currentMode = savedMode;
 
   /* Find out how long we can wait before first limit date.
+   * If there are no input sources or timers, return immediately.
    */
   d = [self limitDateForMode: mode];
-  if (nil == d || nil == date)
+  if (nil == d)
     {
       [arp drain];
       return NO;
     }
 
-  /* Use the earlier of the two dates we have.
-   * Retain the date in case the firing of a timer (or some other event)
-   * releases it.
+  /* Use the earlier of the two dates we have (nil date is like distant past).
    */
-  d = [d earlierDate: date];
-  [d retain];
-
-  /* Wait, listening to our input sources. */
-  [self acceptInputForMode: mode beforeDate: d];
-
-  [d release];
+  if (nil == date)
+    {
+      [self acceptInputForMode: mode beforeDate: nil];
+    }
+  else
+    {
+      /* Retain the date in case the firing of a timer (or some other event)
+       * releases it.
+       */
+      d = [[d earlierDate: date] copy];
+      [self acceptInputForMode: mode beforeDate: d];
+      [d release];
+    }
+
   [arp drain];
   return YES;
 }


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

Reply via email to