internal ListHandle TableLinkList(IntPtr propertyIndex) { var listHandle = new ListHandle(Root ?? this); listHandle.SetHandle(GetLinklist(propertyIndex)); return(listHandle); }
/// <summary> /// Returns the same collection as the one referenced when the <see cref="ThreadSafeReference.List{T}"/> was first created, /// but resolved for the current Realm for this thread. /// </summary> /// <param name="reference">The thread-safe reference to the thread-confined <see cref="IList{T}"/> to resolve in this <see cref="Realm"/>.</param> /// <typeparam name="T">The type of the object, contained in the collection.</typeparam> /// <returns> /// A thread-confined instance of the original <see cref="IList{T}"/> resolved for the current thread or <c>null</c> /// if the list's parent object has been deleted after the reference was created. /// </returns> public IList<T> ResolveReference<T>(ThreadSafeReference.List<T> reference) where T : RealmObject { var listPtr = SharedRealmHandle.ResolveReference(reference); var listHandle = new ListHandle(SharedRealmHandle); listHandle.SetHandle(listPtr); if (!listHandle.IsValid) { return null; } return new RealmList<T>(this, listHandle, reference.Metadata); }
internal ListHandle TableLinkList(IntPtr propertyIndex) { var listHandle = new ListHandle(Root ?? this); // At this point sh is invalid due to its handle being uninitialized, but the root is set correctly // a finalize at this point will not leak anything and the handle will not do anything // now, set the TableView handle... RuntimeHelpers.PrepareConstrainedRegions(); // the following finally will run with no out-of-band exceptions try { } finally { listHandle.SetHandle(this.GetLinklist(propertyIndex)); } // at this point we have atomically acquired a handle and also set the root correctly so it can be unbound correctly return(listHandle); }