All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Mac OS X: QEMU crashes when pressing dead keys
@ 2005-12-08 17:21 Joachim Henke
  2005-12-09  9:34 ` Mike Kronenberg
  0 siblings, 1 reply; 14+ messages in thread
From: Joachim Henke @ 2005-12-08 17:21 UTC (permalink / raw)
  To: qemu-devel

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.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-12-20  9:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-08 17:21 [Qemu-devel] [PATCH] Mac OS X: QEMU crashes when pressing dead keys Joachim Henke
2005-12-09  9:34 ` Mike Kronenberg
2005-12-09 22:34   ` [Qemu-devel] Mac OS X issues Joachim Henke
2005-12-10 13:31     ` Mike Kronenberg
2005-12-11 14:56       ` Joachim Henke
2005-12-11 17:22         ` Mike Kronenberg
2005-12-11 20:47           ` Joachim Henke
2005-12-12 17:38             ` Mike Kronenberg
2005-12-13 16:33               ` Joachim Henke
2005-12-13 19:34                 ` Joachim Henke
2005-12-14 17:53                 ` Mike Kronenberg
2005-12-17  0:03                   ` Joachim Henke
2005-12-19 18:21                     ` Joachim Henke
2005-12-20  9:33                       ` Mike Kronenberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.