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
path: root/main
diff options
context:
space:
mode:
authorMike Krüger <mikkrg@microsoft.com>2019-07-04 17:12:42 +0300
committermonojenkins <jo.shields+jenkins@xamarin.com>2019-07-05 08:16:07 +0300
commitbc42e8ca017837a095a643232f8e516675c88e67 (patch)
tree8c657e4d0039d6932cba7d748efade12fd6a2b28 /main
parentcf845c1100fd76d7fdceed8309e4b7e77fb47d1c (diff)
Fixes VSTS Bug 942353: [FATAL] System.NullReferenceException exception in Mono.MHex.HexEditor.Dispose()
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/942353 Can't really determine the cause - Options should always be != null but it's the only thing that can throw a null ref exception. But in any case Dispose shouldn't cause a fatal exception.
Diffstat (limited to 'main')
-rw-r--r--main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs23
-rw-r--r--main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs3
2 files changed, 16 insertions, 10 deletions
diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs
index febad60b57..3c24bd51bb 100644
--- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs
+++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs
@@ -53,7 +53,7 @@ namespace Mono.MHex
public IHexEditorOptions Options {
get;
- set;
+ private set;
}
IconMargin iconMargin;
@@ -169,15 +169,24 @@ namespace Mono.MHex
Options.Changed += OptionsChanged;
}
+
protected override void Dispose (bool disposing)
{
- Options.Changed -= OptionsChanged;
- if (caretTimer != null) {
- caretTimer.Elapsed -= UpdateCaret;
- caretTimer.Dispose ();
- caretTimer = null;
+ try {
+ base.Dispose (disposing);
+
+ if (disposing) {
+ if (Options != null)
+ Options.Changed -= OptionsChanged;
+ if (caretTimer != null) {
+ caretTimer.Elapsed -= UpdateCaret;
+ caretTimer.Dispose ();
+ caretTimer = null;
+ }
+ }
+ } catch (Exception e) {
+ LoggingService.LogInternalError ("Error while disposing hex editor", e);
}
- base.Dispose (disposing);
}
public void PurgeLayoutCaches ()
diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs
index 68e508820b..808c90ee48 100644
--- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs
+++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs
@@ -47,9 +47,6 @@ namespace Mono.MHex
get {
return editor.Options;
}
- set {
- editor.Options = value;
- }
}
public void PurgeLayoutCaches ()