Ken Thomases : winemac: Clean up fully-delivered events in queues which aren't being drained.

Alexandre Julliard julliard at winehq.org
Fri Oct 18 14:24:16 CDT 2013


Module: wine
Branch: master
Commit: 761092a2fec5dea6dcbceff5d8dd022f8b1925d3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=761092a2fec5dea6dcbceff5d8dd022f8b1925d3

Author: Ken Thomases <ken at codeweavers.com>
Date:   Thu Oct 17 23:43:49 2013 -0500

winemac: Clean up fully-delivered events in queues which aren't being drained.

Some events get queued for all GUI-connected threads but are only processed
by the first to dequeue them.  Other threads which tend their event queue
discard such already-processed events.  However, some threads may be
connected to the GUI but never tend their event queue.  To prevent such
threads from accumulating zombie events, the zombies are cleared each time a
new event is queued.

---

 dlls/winemac.drv/cocoa_event.m |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_event.m b/dlls/winemac.drv/cocoa_event.m
index faeb033..3b35576 100644
--- a/dlls/winemac.drv/cocoa_event.m
+++ b/dlls/winemac.drv/cocoa_event.m
@@ -171,10 +171,16 @@ static const OSType WineHotKeySignature = 'Wine';
 
     - (void) postEventObject:(MacDrvEvent*)event
     {
+        NSIndexSet* indexes;
         MacDrvEvent* lastEvent;
 
         [eventsLock lock];
 
+        indexes = [events indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop){
+            return ((MacDrvEvent*)obj)->event->deliver <= 0;
+        }];
+        [events removeObjectsAtIndexes:indexes];
+
         if ((event->event->type == MOUSE_MOVED ||
              event->event->type == MOUSE_MOVED_ABSOLUTE) &&
             event->event->deliver == INT_MAX &&




More information about the wine-cvs mailing list