Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 2d98672

Browse files
committed
Fixes 1026106 - in some cases, NSEvent seems to have been null.
This introduces a null check, and also introduces additional debug level checks for others, just to make sure if we do run into this while debugging, that we are aware.
1 parent 85b19cd commit 2d98672

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuExtensionsMac.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
using AppKit;
3030
using CoreGraphics;
3131
using Foundation;
32+
using MonoDevelop.Core;
3233
using MonoDevelop.Ide;
3334
#endif
3435

@@ -136,6 +137,20 @@ public static void ShowContextMenu (NSView parent, int x, int y, NSMenu menu, bo
136137
0, 0,
137138
parent.Window.WindowNumber,
138139
null, 0, 0, 0);
140+
141+
// the following lines are here to dianose & fix VSTS 1026106 - we were getting
142+
// a SigSegv from here and it is likely caused by NSEven being null, however
143+
// it's worth leaving Debug checks in just to be on the safe side
144+
if (tmp_event == null) {
145+
// since this is often called outside of a try/catch loop, we'll just
146+
// log an error and not throw the exception
147+
LoggingService.LogInternalError (new ArgumentNullException ("tmp_event"));
148+
return;
149+
}
150+
151+
System.Diagnostics.Debug.Assert (parent != null, "Parent was modified (set to null) during execution.");
152+
System.Diagnostics.Debug.Assert (menu != null, "Menu was modified (set to null) during execution.");
153+
139154
NSMenu.PopUpContextMenu (menu, tmp_event, parent);
140155
}
141156
}

0 commit comments

Comments
 (0)