private QueryHandle CreateQuery(Schema.ObjectSchema elementType) { var tableHandle = _realm.Metadata[elementType.Name].Table; var queryHandle = tableHandle.TableWhere(); //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 { queryHandle.SetHandle(NativeTable.Where(tableHandle)); }//at this point we have atomically acquired a handle and also set the root correctly so it can be unbound correctly return(queryHandle); }
internal QueryHandle TableWhere() { var queryHandle = RootedQueryHandle(); //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 { queryHandle.SetHandle(NativeTable.Where(this)); }//at this point we have atomically acquired a handle and also set the root correctly so it can be unbound correctly return(queryHandle); }