Skip to content

Commit bd662bc

Browse files
committed
Avoid false-positive warnings for unallocated ArrayPtr
1 parent 9cec764 commit bd662bc

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/SIL.LCModel.Utils/ArrayPtr.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ public void Dispose()
149149
/// ------------------------------------------------------------------------------------
150150
protected virtual void Dispose(bool disposing)
151151
{
152-
// Only warn for finalized instances that actually own allocated memory.
153-
Debug.WriteLineIf(!disposing && m_ownMemory,
152+
// Only warn for finalized instances that own an unmanaged buffer that was
153+
// actually allocated by this ArrayPtr.
154+
Debug.WriteLineIf(!disposing && m_ownMemory && m_ptr != IntPtr.Zero,
154155
"****** Missing Dispose() call for " + GetType().Name + ". ****** ");
155156

156157
// Must not be run more than once.

0 commit comments

Comments
 (0)