Switched to using SafeHandle for native code interrupt
Summary: This PR fixes issue #295 - Created a new internal YGNodeHandle class extending SafeHandle. - YogaNode now stores a reference to YGNodeHandle. - Removed finalizer from YogaNode. - Pulling in System.Runtime.Handles 4.3.0. Closes https://github.com/facebook/yoga/pull/297 Reviewed By: emilsjolander Differential Revision: D4365462 Pulled By: splhack fbshipit-source-id: 73293b105962cbedb71f4e3d8d1244251db1ea79
This commit is contained in:
committed by
Facebook Github Bot
parent
df0f76bba5
commit
4717594e93
@@ -17,7 +17,7 @@ namespace Facebook.Yoga
|
||||
{
|
||||
public partial class YogaNode : IEnumerable<YogaNode>
|
||||
{
|
||||
private IntPtr _ygNode;
|
||||
private Native.YGNodeHandle _ygNode;
|
||||
private WeakReference _parent;
|
||||
private List<YogaNode> _children;
|
||||
private MeasureFunction _measureFunction;
|
||||
@@ -29,17 +29,12 @@ namespace Facebook.Yoga
|
||||
YogaLogger.Initialize();
|
||||
|
||||
_ygNode = Native.YGNodeNew();
|
||||
if (_ygNode == IntPtr.Zero)
|
||||
if (_ygNode.IsInvalid)
|
||||
{
|
||||
throw new InvalidOperationException("Failed to allocate native memory");
|
||||
}
|
||||
}
|
||||
|
||||
~YogaNode()
|
||||
{
|
||||
Native.YGNodeFree(_ygNode);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_measureFunction = null;
|
||||
|
Reference in New Issue
Block a user