|
From: | Ivan Vučica |
Subject: | Re: [Gnustep-cvs] r40000 - in /libs/base/trunk: ChangeLog Source/GSRunLoopCtxt.h Source/NSRunLoop.m Source/win32/GSRunLoopCtxt.m |
Date: | Sat, 16 Jul 2016 18:09:56 +0100 |
Author: rfm
Date: Sat Jul 16 10:25:24 2016
New Revision: 40000
URL: http://svn.gna.org/viewcvs/gnustep?rev=40000&view=rev
Log:
fix bad return value when polling for windows messages
Modified:
libs/base/trunk/ChangeLog
libs/base/trunk/Source/GSRunLoopCtxt.h
libs/base/trunk/Source/NSRunLoop.m
libs/base/trunk/Source/win32/GSRunLoopCtxt.m
Modified: libs/base/trunk/ChangeLog
URL: http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=40000&r1=39999&r2=40000&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog (original)
+++ libs/base/trunk/ChangeLog Sat Jul 16 10:25:24 2016
@@ -1,3 +1,10 @@
+2016-07-16 Richard Frith-Macdonald <address@hidden>
+
+ * Source/win32/GSRunLoopCtxt.m: fix bug in return value when polling.
+ The poll method must return YES if any input source fired, including
+ handling of windows messages which are already available and require
+ no wait.
+
2016-07-15 Richard Frith-Macdonald <address@hidden>
* configure.ac:
Modified: libs/base/trunk/Source/GSRunLoopCtxt.h
URL: http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/GSRunLoopCtxt.h?rev=40000&r1=39999&r2=40000&view=diff
==============================================================================
--- libs/base/trunk/Source/GSRunLoopCtxt.h (original)
+++ libs/base/trunk/Source/GSRunLoopCtxt.h Sat Jul 16 10:25:24 2016
@@ -83,7 +83,7 @@
}
/* Check to see of the thread has been awakened, blocking until it
* does get awakened or until the limit date has been reached.
- * A date in the past (or nil) results in a check follwed by an
+ * A date in the past (or nil) results in a check followed by an
* immediate return.
*/
+ (BOOL) awakenedBefore: (NSDate*)when;
Modified: libs/base/trunk/Source/NSRunLoop.m
URL: http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSRunLoop.m?rev=40000&r1=39999&r2=40000&view=diff
==============================================================================
--- libs/base/trunk/Source/NSRunLoop.m (original)
+++ libs/base/trunk/Source/NSRunLoop.m Sat Jul 16 10:25:24 2016
@@ -1162,11 +1162,6 @@
{
BOOL done = NO;
NSDate *when;
-
- if ([_contextStack indexOfObjectIdenticalTo: context] == NSNotFound)
- {
- [_contextStack addObject: context];
- }
while (NO == done)
{
@@ -1224,6 +1219,10 @@
@"accept I/P before %d millisec from now in %@",
timeout_ms, mode);
+ if ([_contextStack indexOfObjectIdenticalTo: context] == NSNotFound)
+ {
+ [_contextStack addObject: context];
+ }
done = [context pollUntil: timeout_ms within: _contextStack];
if (NO == done)
{
@@ -1236,16 +1235,18 @@
[self _checkPerformers: context];
GSPrivateNotifyASAP(_currentMode);
[context endPoll];
+
+ /* Once a poll has been completed on a context, we can remove that
+ * context from the stack even if it actually polling at an outer
+ * level of re-entrancy ... since the poll we have just done will
+ * have handled any events that the outer levels would have wanted
+ * to handle, and the polling for this context will be marked as
+ * ended.
+ */
+ [_contextStack removeObjectIdenticalTo: context];
}
- /* Once a poll has been completed on a context, we can remove that
- * context from the stack even if it actually polling at an outer
- * level of re-entrancy ... since the poll we have just done will
- * have handled any events that the outer levels would have wanted
- * to handle, and the polling for this context will be marked as ended.
- */
_currentMode = savedMode;
- [_contextStack removeObjectIdenticalTo: context];
}
NS_HANDLER
{
Modified: libs/base/trunk/Source/win32/GSRunLoopCtxt.m
URL: http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/win32/GSRunLoopCtxt.m?rev=40000&r1=39999&r2=40000&view=diff
==============================================================================
--- libs/base/trunk/Source/win32/GSRunLoopCtxt.m (original)
+++ libs/base/trunk/Source/win32/GSRunLoopCtxt.m Sat Jul 16 10:25:24 2016
@@ -282,6 +282,7 @@
int wait_timeout;
DWORD wait_return;
BOOL immediate = NO;
+ BOOL existingMessages = NO;
// Set timeout how much time should wait
if (milliseconds >= 0)
@@ -404,10 +405,11 @@
*/
if ([self processAllWindowsMessages: num_winMsgs within: contexts] == YES)
{
- wait_timeout = 0; // Processed something ... no need to wait.
- }
-
- if (num_winMsgs > 0)
+ // Processed something ... no need to wait.
+ wait_return = WAIT_OBJECT_0;
+ existingMessages = YES;
+ }
+ else if (num_winMsgs > 0)
{
/*
* Wait for signalled events or window messages.
@@ -465,7 +467,7 @@
}
/*
- * Trigger any watchers which are set up to for every runloop wait.
+ * Trigger any watchers which are set up to trigger for every runloop wait.
*/
count = GSIArrayCount(_trigger);
completed = NO;
@@ -499,12 +501,17 @@
GSPrivateNotifyASAP(mode);
}
+ if (existingMessages)
+ {
+ NSDebugMLLog(@"NSRunLoop", @"processed windows messages");
+ return YES;
+ }
+
// if there are windows message
if (wait_return == WAIT_OBJECT_0 + num_handles)
{
NSDebugMLLog(@"NSRunLoop", @"processing windows messages");
- [self processAllWindowsMessages: num_winMsgs within: contexts];
- return NO;
+ return [self processAllWindowsMessages: num_winMsgs within: contexts];
}
// if there aren't events
_______________________________________________
Gnustep-cvs mailing list
address@hidden
https://mail.gna.org/listinfo/gnustep-cvs
[Prev in Thread] | Current Thread | [Next in Thread] |