6bdd276d05
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
28 lines
1.2 KiB
Diff
28 lines
1.2 KiB
Diff
From ccd93c714859737d9b40b547e433a690ad6a9e55 Mon Sep 17 00:00:00 2001
|
|
From: iain holmes <iain@xamarin.com>
|
|
Date: Thu, 30 Jun 2016 12:34:56 +0100
|
|
Subject: [PATCH] [Gdk] Don't crash when turning screen off
|
|
|
|
Check the length of characters in the NSFlagsChanged event before accessing
|
|
the individual characters because cmd+alt+power key doesn't have any characters
|
|
so an ObjC will throw an exception.
|
|
|
|
Fixes BXC #41657
|
|
---
|
|
gdk/quartz/gdkevents-quartz.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
|
|
index 8cb05c0..0fa63be 100644
|
|
--- a/gdk/quartz/gdkevents-quartz.c
|
|
+++ b/gdk/quartz/gdkevents-quartz.c
|
|
@@ -1847,7 +1847,7 @@ gdk_event_translate (GdkEvent *event,
|
|
NSView *tmp_view = [nswindow firstResponder];
|
|
gboolean gtk_child = FALSE;
|
|
|
|
- if (event_type == NSKeyDown && ([nsevent modifierFlags] & NSCommandKeyMask) != 0 && [[nsevent characters] characterAtIndex:0] == 'z')
|
|
+ if (event_type == NSKeyDown && ([nsevent modifierFlags] & NSCommandKeyMask) != 0 && [[nsevent characters] length] > 0 && [[nsevent characters] characterAtIndex:0] == 'z')
|
|
{
|
|
if ([tmp_view respondsToSelector:@selector(undoManager)])
|
|
{
|