From 396ae2f0d929d00b93831ad38f43a8ff12584195 Mon Sep 17 00:00:00 2001 From: Eusebiu Marcu Date: Tue, 5 Apr 2011 15:55:22 +0300 Subject: [PATCH] Fix memory exception. --- .../Debugger.AddIn/Pads/Commands/MemoryPadCommands.cs | 2 +- src/AddIns/Debugger/Debugger.AddIn/Pads/MemoryPad.cs | 4 ++-- src/AddIns/Debugger/Debugger.Core/Interop/NativeMethods.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/AddIns/Debugger/Debugger.AddIn/Pads/Commands/MemoryPadCommands.cs b/src/AddIns/Debugger/Debugger.AddIn/Pads/Commands/MemoryPadCommands.cs index 6c0809a1a5..c234d50292 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Pads/Commands/MemoryPadCommands.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Pads/Commands/MemoryPadCommands.cs @@ -119,7 +119,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads { if (this.pad != null && this.comboBox != null) { pad.DisplayByteSize = Convert.ToByte(this.comboBox.SelectedValue); - pad.ChangeByteDisplay(); + pad.DisplayMemory(); } base.Run(); } diff --git a/src/AddIns/Debugger/Debugger.AddIn/Pads/MemoryPad.cs b/src/AddIns/Debugger/Debugger.AddIn/Pads/MemoryPad.cs index 914d7cfb05..ed225f50a1 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Pads/MemoryPad.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Pads/MemoryPad.cs @@ -188,10 +188,10 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads return; } - ChangeByteDisplay(); + DisplayMemory(); } - public void ChangeByteDisplay() + public void DisplayMemory() { if (memory == null || memory.Length == 0) return; diff --git a/src/AddIns/Debugger/Debugger.Core/Interop/NativeMethods.cs b/src/AddIns/Debugger/Debugger.Core/Interop/NativeMethods.cs index 1c65879a1f..5c9e6c2d8d 100644 --- a/src/AddIns/Debugger/Debugger.Core/Interop/NativeMethods.cs +++ b/src/AddIns/Debugger/Debugger.Core/Interop/NativeMethods.cs @@ -169,9 +169,9 @@ namespace Debugger.Interop public static byte[] ReadProcessMemory(this Process process, long startAddress, long size) { IntPtr openedProcess = IntPtr.Zero; - byte[] temp = new byte[size]; - + byte[] temp = null; try { + temp = new byte[size]; openedProcess = OpenProcess(ProcessAccessFlags.All, false, (int)process.Id); int outSize;