Fixed wrong pointer passed to unlock method.

This commit is contained in:
soukoku 2015-01-03 12:58:37 -05:00
parent 844f84e259
commit d7a2bebe2a
4 changed files with 17 additions and 9 deletions

View File

@ -81,7 +81,8 @@ namespace NTwain
{ {
if (baseAddr != IntPtr.Zero) if (baseAddr != IntPtr.Zero)
{ {
memoryManager.Unlock(baseAddr); //memoryManager.Unlock(baseAddr);
memoryManager.Unlock(capability.Container);
} }
} }
} }

View File

@ -773,7 +773,8 @@ namespace NTwain.Data
{ {
WriteValue(baseAddr, ref offset, value.ItemType, item); WriteValue(baseAddr, ref offset, value.ItemType, item);
} }
memoryManager.Unlock(baseAddr); //memoryManager.Unlock(baseAddr);
memoryManager.Unlock(_hContainer);
} }
void SetRangeValue(TWRange value, IMemoryManager memoryManager) void SetRangeValue(TWRange value, IMemoryManager memoryManager)
@ -809,7 +810,8 @@ namespace NTwain.Data
{ {
WriteValue(baseAddr, ref offset, value.ItemType, item); WriteValue(baseAddr, ref offset, value.ItemType, item);
} }
memoryManager.Unlock(baseAddr); memoryManager.Unlock(_hContainer);
//memoryManager.Unlock(baseAddr);
} }
#endregion #endregion
@ -1484,7 +1486,8 @@ namespace NTwain.Data
{ {
if (lockPtr != IntPtr.Zero) if (lockPtr != IntPtr.Zero)
{ {
PlatformInfo.Current.MemoryManager.Unlock(lockPtr); PlatformInfo.Current.MemoryManager.Unlock(Item);
//PlatformInfo.Current.MemoryManager.Unlock(lockPtr);
} }
} }
} }

View File

@ -29,7 +29,7 @@ namespace NTwain
/// <summary> /// <summary>
/// Function to unlock a previously locked memory region. /// Function to unlock a previously locked memory region.
/// </summary> /// </summary>
/// <param name="handle">The handle from <see cref="Lock"/>.</param> /// <param name="handle">The same handle passed <see cref="Lock"/>.</param>
void Unlock(IntPtr handle); void Unlock(IntPtr handle);
} }
} }

View File

@ -156,7 +156,8 @@ namespace NTwain.Internals
// data here is allocated by source so needs to use shared mem calls // data here is allocated by source so needs to use shared mem calls
if (lockedPtr != IntPtr.Zero) if (lockedPtr != IntPtr.Zero)
{ {
PlatformInfo.Current.MemoryManager.Unlock(lockedPtr); //PlatformInfo.Current.MemoryManager.Unlock(lockedPtr);
PlatformInfo.Current.MemoryManager.Unlock(dataPtr);
lockedPtr = IntPtr.Zero; lockedPtr = IntPtr.Zero;
} }
if (dataPtr != IntPtr.Zero) if (dataPtr != IntPtr.Zero)
@ -222,7 +223,8 @@ namespace NTwain.Internals
// data here is allocated by source so needs to use shared mem calls // data here is allocated by source so needs to use shared mem calls
if (lockedPtr != IntPtr.Zero) if (lockedPtr != IntPtr.Zero)
{ {
PlatformInfo.Current.MemoryManager.Unlock(lockedPtr); //PlatformInfo.Current.MemoryManager.Unlock(lockedPtr);
PlatformInfo.Current.MemoryManager.Unlock(dataPtr);
lockedPtr = IntPtr.Zero; lockedPtr = IntPtr.Zero;
} }
if (dataPtr != IntPtr.Zero) if (dataPtr != IntPtr.Zero)
@ -300,7 +302,8 @@ namespace NTwain.Internals
{ {
if (lockPtr != IntPtr.Zero) if (lockPtr != IntPtr.Zero)
{ {
PlatformInfo.Current.MemoryManager.Unlock(lockPtr); PlatformInfo.Current.MemoryManager.Unlock(xferInfo.Memory.TheMem);
//PlatformInfo.Current.MemoryManager.Unlock(lockPtr);
} }
} }
} }
@ -376,7 +379,8 @@ namespace NTwain.Internals
{ {
if (lockPtr != IntPtr.Zero) if (lockPtr != IntPtr.Zero)
{ {
PlatformInfo.Current.MemoryManager.Unlock(lockPtr); PlatformInfo.Current.MemoryManager.Unlock(xferInfo.Memory.TheMem);
//PlatformInfo.Current.MemoryManager.Unlock(lockPtr);
} }
} }
outStream.Write(buffer, 0, buffer.Length); outStream.Write(buffer, 0, buffer.Length);