Skip to content

Commit 9cec764

Browse files
committed
Fix false-positive ArrayPtr dispose warning
1 parent b138092 commit 9cec764

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/SIL.LCModel.Utils/ArrayPtr.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ public bool IsDisposed
111111
/// ------------------------------------------------------------------------------------
112112
~ArrayPtr()
113113
{
114-
//if (this != s_null) // TODO (Hasso) 2016.11: is this the only place this ugly hack is needed?
115114
Dispose(false);
116115
// The base class finalizer is called automatically.
117116
}
@@ -150,8 +149,8 @@ public void Dispose()
150149
/// ------------------------------------------------------------------------------------
151150
protected virtual void Dispose(bool disposing)
152151
{
153-
// If you're getting this line it means that you forgot to call Dispose().
154-
Debug.WriteLineIf(!disposing,// && this != s_Null, // TODO (Hasso) 2016.11: is this the only place this ugly hack is needed?
152+
// Only warn for finalized instances that actually own allocated memory.
153+
Debug.WriteLineIf(!disposing && m_ownMemory,
155154
"****** Missing Dispose() call for " + GetType().Name + ". ****** ");
156155

157156
// Must not be run more than once.

0 commit comments

Comments
 (0)