From c6cb17fdd8b13bdea5a797e71ae70e9b017e3ad2 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Fri, 6 Jun 2008 14:22:49 +0200 Subject: [PATCH] Catch exceptions in processCommandQueue: --- src/MacVim/MMVimController.m | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/MacVim/MMVimController.m b/src/MacVim/MMVimController.m index e27ee3ff..60690bee 100644 --- a/src/MacVim/MMVimController.m +++ b/src/MacVim/MMVimController.m @@ -525,28 +525,33 @@ static NSTimeInterval MMResendInterval = 0.5; { if (!isInitialized) return; - unsigned i, count = [queue count]; - if (count % 2) { - NSLog(@"WARNING: Uneven number of components (%d) in flush queue " - "message; ignoring this message.", count); - return; - } + @try { + unsigned i, count = [queue count]; + if (count % 2) { + NSLog(@"WARNING: Uneven number of components (%d) in flush queue " + "message; ignoring this message.", count); + return; + } - inProcessCommandQueue = YES; + inProcessCommandQueue = YES; - //NSLog(@"======== %s BEGIN ========", _cmd); - for (i = 0; i < count; i += 2) { - NSData *value = [queue objectAtIndex:i]; - NSData *data = [queue objectAtIndex:i+1]; + //NSLog(@"======== %s BEGIN ========", _cmd); + for (i = 0; i < count; i += 2) { + NSData *value = [queue objectAtIndex:i]; + NSData *data = [queue objectAtIndex:i+1]; - int msgid = *((int*)[value bytes]); - //NSLog(@"%s%s", _cmd, MessageStrings[msgid]); + int msgid = *((int*)[value bytes]); + //NSLog(@"%s%s", _cmd, MessageStrings[msgid]); - [self handleMessage:msgid data:data]; - } - //NSLog(@"======== %s END ========", _cmd); + [self handleMessage:msgid data:data]; + } + //NSLog(@"======== %s END ========", _cmd); - [windowController processCommandQueueDidFinish]; + [windowController processCommandQueueDidFinish]; + } + @catch (NSException *e) { + NSLog(@"Exception caught whilst processing command queue: %@", e); + } inProcessCommandQueue = NO; -- 2.11.4.GIT