diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2019-09-11 10:03:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-11 10:03:56 +0300 |
commit | 78e9e1d5c6bd875dd63e4374eaf7598937643d8f (patch) | |
tree | bdcec0da6734a0f3579c444471f7d29642a2e727 /main/src/core/MonoDevelop.Ide | |
parent | 659014b37fe1854344566675b952591cd5efcfd4 (diff) | |
parent | 62b4cec67e22118e7622b0b0aa3604398967d572 (diff) |
Merge pull request #8664 from mono/fix-935180
[IDE] Check that events passed to the keypress handler are key events
Diffstat (limited to 'main/src/core/MonoDevelop.Ide')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs index 637d802967..41b0d58d87 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs @@ -310,6 +310,18 @@ namespace MonoDevelop.Components.Commands #if MAC AppKit.NSEvent OnNSEventKeyPress (AppKit.NSEvent ev) { + // Protect against non-keyevents being passed here. See VSTS #935180. It seems that certain + // keyboard remapper applications such as Ukuele can cause non-keyevents to be sent to key event handlers. + if (ev.Type != AppKit.NSEventType.KeyDown && ev.Type != AppKit.NSEventType.KeyUp) { + LoggingService.LogInternalError (new Exception ($"Event is type {ev.Type} and not a KeyEvent")); + return null; + } + + if (string.IsNullOrEmpty (ev.Characters)) { + LoggingService.LogInternalError (new Exception ($"Keyevent has no characters")); + return null; + } + // If we have a native window that can handle this command, let it process // the keys itself and do not go through the command manager. // Events in Gtk windows do not pass through here except when they're done |