Author: rfm
Date: Mon Jul 14 10:24:30 2014
New Revision: 37995

URL: http://svn.gna.org/viewcvs/gnustep?rev=37995&view=rev
Log:
attempt to fix bug #39107

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

Modified: libs/base/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=37995&r1=37994&r2=37995&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog   (original)
+++ libs/base/trunk/ChangeLog   Mon Jul 14 10:24:30 2014
@@ -1,3 +1,8 @@
+2014-07-14  Richard Frith-Macdonald <[email protected]>
+
+       * Source/NSRunLoop.m: ([-runMode:beforeDate:]) check performers as
+       well as notifications etc ... should fix bug #39107
+
 2014-02-17  Larry Campbell <[email protected]>
 
        * Source/NSJSONSerialization.m:

Modified: libs/base/trunk/Source/NSRunLoop.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSRunLoop.m?rev=37995&r1=37994&r2=37995&view=diff
==============================================================================
--- libs/base/trunk/Source/NSRunLoop.m  (original)
+++ libs/base/trunk/Source/NSRunLoop.m  Mon Jul 14 10:24:30 2014
@@ -390,7 +390,7 @@
 
 - (void) _addWatcher: (GSRunLoopWatcher*)item
             forMode: (NSString*)mode;
-- (void) _checkPerformers: (GSRunLoopCtxt*)context;
+- (BOOL) _checkPerformers: (GSRunLoopCtxt*)context;
 - (GSRunLoopWatcher*) _getWatcher: (void*)data
                             type: (RunLoopEventType)type
                          forMode: (NSString*)mode;
@@ -429,9 +429,9 @@
     }
 }
 
-- (void) _checkPerformers: (GSRunLoopCtxt*)context
-{
-  NSAutoreleasePool    *arp = [NSAutoreleasePool new];
+- (BOOL) _checkPerformers: (GSRunLoopCtxt*)context
+{
+  BOOL                  found = NO;
 
   if (context != nil)
     {
@@ -440,12 +440,14 @@
 
       if (count > 0)
        {
+          NSAutoreleasePool    *arp = [NSAutoreleasePool new];
          GSRunLoopPerformer    *array[count];
          NSMapEnumerator       enumerator;
          GSRunLoopCtxt         *context;
          void                  *mode;
          unsigned              i;
 
+          found = YES;
          /*
           * Copy the array - because we have to cancel the requests
           * before firing.
@@ -492,9 +494,10 @@
              RELEASE(array[i]);
              IF_NO_GC([arp emptyPool];)
            }
-       }
-    }
-  [arp drain];
+          [arp drain];
+       }
+    }
+  return found;
 }
 
 /**
@@ -1243,6 +1246,8 @@
 - (BOOL) runMode: (NSString*)mode beforeDate: (NSDate*)date
 {
   NSAutoreleasePool    *arp = [NSAutoreleasePool new];
+  NSString              *savedMode = _currentMode;
+  GSRunLoopCtxt                *context;
   NSDate               *d;
 
   NSAssert(mode != nil, NSInvalidArgumentException);
@@ -1251,6 +1256,14 @@
    */
   GSPrivateCheckTasks(); 
   GSPrivateNotifyASAP(mode); 
+
+  /* And process any performers scheduled in the loop (eg something from
+   * another thread.
+   */
+  _currentMode = mode;
+  context = NSMapGet(_contextMap, mode);
+  [self _checkPerformers: context];
+  _currentMode = savedMode;
 
   /* Find out how long we can wait before first limit date.
    */


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

Reply via email to