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:
authorMike Krüger <mikkrg@microsoft.com>2019-07-04 17:12:42 +0300
committerMike Krüger <mikkrg@microsoft.com>2019-07-04 17:12:42 +0300
commitc27e623456d6ab636799e1facd5ef5710371723e (patch)
tree4c8d815482dbb686318e4a8c8503452a575beacf /main/src/addins/MonoDevelop.HexEditor
parente7b85c69e92c23ac956a127e2c8fe763d6d88d18 (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/src/addins/MonoDevelop.HexEditor')
-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 ()