From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EkPV7-0001OZ-OW for qemu-devel@nongnu.org; Thu, 08 Dec 2005 12:24:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EkPV3-0001KY-L8 for qemu-devel@nongnu.org; Thu, 08 Dec 2005 12:24:12 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EkPV2-0001KN-VA for qemu-devel@nongnu.org; Thu, 08 Dec 2005 12:24:09 -0500 Received: from [217.13.200.26] (helo=mail6.worldserver.net) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EkPW5-0008SY-7h for qemu-devel@nongnu.org; Thu, 08 Dec 2005 12:25:14 -0500 Message-Id: <0BE5F4F1-1337-43E6-AD37-ED47FCE3BDCB@stud.tu-ilmenau.de> From: Joachim Henke Date: Thu, 8 Dec 2005 18:21:51 +0100 Subject: [Qemu-devel] [PATCH] Mac OS X: QEMU crashes when pressing dead keys Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This concerns the current cocoa version in cvs: When typing into the monitor and accidentally pressing a dead key, qemu quits immediately and all unsafed data in the guest os is lost: 2005-12-04 15:15:00.833 qemu[193] Exception raised during posting of notification. Ignored. exception: *** -[NSCFString characterAtIndex:]: Range or index out of bounds Even if you don't have a Mac, you can retrace this bug by following these links: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSEvent.html#//apple_ref/occ/instm/NSEvent/characters http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSString.html#//apple_ref/occ/instm/NSString/characterAtIndex: [event characters] returns an empty string for dead keys, and so calling [[event characters] characterAtIndex:0] will raise an NSRangeException that crashes qemu. The following patch fixes this bug: Index: cocoa.m =================================================================== RCS file: /cvsroot/qemu/qemu/cocoa.m,v retrieving revision 1.5 diff -u -r1.5 cocoa.m --- cocoa.m 30 Oct 2005 18:24:49 -0000 1.5 +++ cocoa.m 4 Dec 2005 16:16:28 -0000 @@ -454,8 +454,11 @@ kbd_put_keysym(QEMU_KEY_UP); break; default: + { + NSString *ks = [event characters]; + if ([ks length] > 0) + kbd_put_keysym([ks characterAtIndex:0]); + } - kbd_put_keysym([[event characters] characterAtIndex:0]); - break; } } } To Mike Kronenberg: Q has the same problem. Pressing a dead key in the monitor locks the emulation and you're not able to do anything further. Would you be so kind to confirm this? It seems that Fabrice doesn't trust my fixes. Thanks! Regards Jo.