Commit ce5b6079 authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

Merge pull request #10 from cdhowie/master

Fix leaking a Lua object reference when a managed Lua object wrapper is finalized without being disposed
parents c727aaf1 0e1211fa
...@@ -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