Commit 0e1211fa authored by Chris Howie's avatar Chris Howie
Browse files

Fix leaking a Lua object when a managed Lua object wrapper is finalized without being disposed

parent 206e1f84
...@@ -56,10 +56,8 @@ namespace NLua ...@@ -56,10 +56,8 @@ namespace NLua
public virtual void Dispose (bool disposeManagedResources) public virtual void Dispose (bool disposeManagedResources)
{ {
if (!_Disposed) { if (!_Disposed) {
if (disposeManagedResources) { if (_Reference != 0)
if (_Reference != 0) _Interpreter.dispose (_Reference);
_Interpreter.dispose (_Reference);
}
_Interpreter = null; _Interpreter = null;
_Disposed = true; _Disposed = true;
...@@ -80,4 +78,4 @@ namespace NLua ...@@ -80,4 +78,4 @@ namespace NLua
return _Reference; return _Reference;
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment