Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@xamarin.com>2019-09-11 10:03:56 +0300
committerGitHub <noreply@github.com>2019-09-11 10:03:56 +0300
commit78e9e1d5c6bd875dd63e4374eaf7598937643d8f (patch)
treebdcec0da6734a0f3579c444471f7d29642a2e727 /main/src/core/MonoDevelop.Ide
parent659014b37fe1854344566675b952591cd5efcfd4 (diff)
parent62b4cec67e22118e7622b0b0aa3604398967d572 (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.cs12
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