Remove unused GCHandle
Summary: - Unused _context GCHandle prevent calling CSSNode destructor. - CSSNode C# impl will retain children node when calling CSSNodeInsertChild, so the lifetime of C# object is the same as the lifetime of native instance. Reviewed By: emilsjolander Differential Revision: D3981697 fbshipit-source-id: 71f0f7be97fd694d27934d7d07deb64ee08b2840
This commit is contained in:
committed by
Facebook Github Bot
parent
56279110c0
commit
b57abb2f60
@@ -18,7 +18,6 @@ namespace Facebook.CSSLayout
|
|||||||
{
|
{
|
||||||
private bool _isDisposed;
|
private bool _isDisposed;
|
||||||
private IntPtr _cssNode;
|
private IntPtr _cssNode;
|
||||||
private IntPtr _context;
|
|
||||||
|
|
||||||
private CSSNode _parent;
|
private CSSNode _parent;
|
||||||
private List<CSSNode> _children;
|
private List<CSSNode> _children;
|
||||||
@@ -83,9 +82,7 @@ namespace Facebook.CSSLayout
|
|||||||
if (_cssNode != IntPtr.Zero)
|
if (_cssNode != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
Native.CSSNodeFree(_cssNode);
|
Native.CSSNodeFree(_cssNode);
|
||||||
GCHandle.FromIntPtr(_context).Free();
|
|
||||||
_cssNode = IntPtr.Zero;
|
_cssNode = IntPtr.Zero;
|
||||||
_context = IntPtr.Zero;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,8 +94,6 @@ namespace Facebook.CSSLayout
|
|||||||
}
|
}
|
||||||
|
|
||||||
_cssNode = Native.CSSNodeNew();
|
_cssNode = Native.CSSNodeNew();
|
||||||
_context = (IntPtr)GCHandle.Alloc(this);
|
|
||||||
Native.CSSNodeSetContext(_cssNode, _context);
|
|
||||||
_children = new List<CSSNode>(4);
|
_children = new List<CSSNode>(4);
|
||||||
Native.CSSNodeSetPrintFunc(_cssNode, _printFunc);
|
Native.CSSNodeSetPrintFunc(_cssNode, _printFunc);
|
||||||
}
|
}
|
||||||
@@ -717,4 +712,4 @@ namespace Facebook.CSSLayout
|
|||||||
return ((IEnumerable<CSSNode>)_children).GetEnumerator();
|
return ((IEnumerable<CSSNode>)_children).GetEnumerator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user