mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Avoid enumerating vim controllers
Don't enumerate vim controllers when processing input since it may potentially be a huge operation. If the vim controller array were to be modified during input processing (should never happen) MacVim would crash.
This commit is contained in:
@@ -2148,13 +2148,19 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
NSDictionary *queues = inputQueues;
|
||||
inputQueues = [NSMutableDictionary new];
|
||||
|
||||
MMVimController *vc;
|
||||
NSEnumerator *e = [vimControllers objectEnumerator];
|
||||
while ((vc = [e nextObject])) {
|
||||
NSNumber *key = [NSNumber numberWithUnsignedInt:[vc identifier]];
|
||||
NSArray *q = [queues objectForKey:key];
|
||||
if (q)
|
||||
[vc processInputQueue:q];
|
||||
// Pass each input queue on to the vim controller with matching identifier.
|
||||
NSEnumerator *e = [queues keyEnumerator];
|
||||
NSNumber *key;
|
||||
while ((key = [e nextObject])) {
|
||||
unsigned ukey = [key unsignedIntValue];
|
||||
int i = 0, count = [vimControllers count];
|
||||
for (i = 0; i < count; ++i) {
|
||||
MMVimController *vc = [vimControllers objectAtIndex:i];
|
||||
if (ukey == [vc identifier]) {
|
||||
[vc processInputQueue:[queues objectForKey:key]];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[queues release];
|
||||
|
||||
Reference in New Issue
Block a user