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:
authorAnže Vodovnik <anvod@microsoft.com>2020-01-14 11:56:30 +0300
committerAnže Vodovnik <anvod@microsoft.com>2020-01-14 11:56:30 +0300
commitc85146dbbbe548652312dbb257436d5f0cfe85cb (patch)
treec8ce6c2f265d6244fa33489b0722c0344e4edc85
parente4e08f821ad5f75d9177f03dfe4b7a1e5df7f346 (diff)
Additional check for VSTS 1026106, SigSegv on context menu pop-up.pr-anvod-102606-checks
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuExtensionsMac.cs36
1 files changed, 21 insertions, 15 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuExtensionsMac.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuExtensionsMac.cs
index 7e57583c92..cb9306b965 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuExtensionsMac.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuExtensionsMac.cs
@@ -105,11 +105,30 @@ namespace MonoDevelop.Components
0, 0,
nswindow.WindowNumber,
null, 0, 0, 0);
- NSMenu.PopUpContextMenu (menu, tmp_event, nsview);
+
+ SafePopUpContextMenu (menu, tmp_event, nsview, parent);
}
});
}
+ private static void SafePopUpContextMenu (NSMenu menu, NSEvent tmp_event, NSView nsview, object parent)
+ {
+ // the following lines are here to dianose & fix VSTS 1026106 - we were getting
+ // a SigSegv from here and it is likely caused by NSEvent being null, however
+ // it's worth leaving Debug checks in just to be on the safe side
+ if (tmp_event == null) {
+ // since this is often called outside of a try/catch loop, we'll just
+ // log an error and not throw the exception
+ LoggingService.LogInternalError (new ArgumentNullException (nameof (tmp_event)));
+ return;
+ }
+
+ System.Diagnostics.Debug.Assert (parent != null, "Parent was modified (set to null) during execution.");
+ System.Diagnostics.Debug.Assert (menu != null, "Menu was modified (set to null) during execution.");
+
+ NSMenu.PopUpContextMenu (menu, tmp_event, nsview);
+ }
+
public static void ShowContextMenu (NSView parent, int x, int y, ContextMenu menu, Action closeHandler, bool selectFirstItem = false)
{
var nsMenu = FromMenu (menu, closeHandler, null);
@@ -138,20 +157,7 @@ namespace MonoDevelop.Components
parent.Window.WindowNumber,
null, 0, 0, 0);
- // the following lines are here to dianose & fix VSTS 1026106 - we were getting
- // a SigSegv from here and it is likely caused by NSEvent being null, however
- // it's worth leaving Debug checks in just to be on the safe side
- if (tmp_event == null) {
- // since this is often called outside of a try/catch loop, we'll just
- // log an error and not throw the exception
- LoggingService.LogInternalError (new ArgumentNullException (nameof(tmp_event)));
- return;
- }
-
- System.Diagnostics.Debug.Assert (parent != null, "Parent was modified (set to null) during execution.");
- System.Diagnostics.Debug.Assert (menu != null, "Menu was modified (set to null) during execution.");
-
- NSMenu.PopUpContextMenu (menu, tmp_event, parent);
+ SafePopUpContextMenu (menu, tmp_event, parent, parent);
}
}