@@ -538,7 +538,7 @@ class _ByteVectorCondition<EntityT>
538538 func) =>
539539 withNativeBytes (
540540 _value,
541- (Pointer <Uint8 > ptr, int size) =>
541+ (Pointer <Uint8 > ptr, int size) =>
542542 func (builder._cBuilder, _property._model.id.id, ptr, size));
543543
544544 @override
@@ -652,7 +652,11 @@ class Query<T> {
652652 /// the whole result, e.g. for "result paging".
653653 ///
654654 /// Set offset=0 to reset to the default - starting from the first element.
655- set offset (int offset) => checkObx (C .query_offset (_ptr, offset));
655+ set offset (int offset) {
656+ final result = checkObx (C .query_offset (_ptr, offset));
657+ reachabilityFence (this );
658+ return result;
659+ }
656660
657661 /// Configure a [limit] for this query.
658662 ///
@@ -661,13 +665,18 @@ class Query<T> {
661665 /// the whole result, e.g. for "result paging".
662666 ///
663667 /// Set limit=0 to reset to the default behavior - no limit applied.
664- set limit (int limit) => checkObx (C .query_limit (_ptr, limit));
668+ set limit (int limit) {
669+ final result = checkObx (C .query_limit (_ptr, limit));
670+ reachabilityFence (this );
671+ return result;
672+ }
665673
666674 /// Returns the number of matching Objects.
667675 int count () {
668676 final ptr = malloc <Uint64 >();
669677 try {
670678 checkObx (C .query_count (_ptr, ptr));
679+ reachabilityFence (this );
671680 return ptr.value;
672681 } finally {
673682 malloc.free (ptr);
@@ -710,12 +719,14 @@ class Query<T> {
710719 _store.runInTransaction (TxMode .read, () {
711720 checkObx (C .query_visit (_ptr, visitor, nullptr));
712721 });
722+ reachabilityFence (this );
713723 return result;
714724 }
715725
716726 /// Finds Objects matching the query and returns their IDs.
717727 List <int > findIds () {
718728 final idArrayPtr = checkObxPtr (C .query_find_ids (_ptr), 'find ids' );
729+ reachabilityFence (this );
719730 try {
720731 final idArray = idArrayPtr.ref;
721732 return idArray.count == 0
@@ -732,6 +743,7 @@ class Query<T> {
732743 final collector = objectCollector (result, _store, _entity);
733744 _store.runInTransaction (
734745 TxMode .read, () => checkObx (C .query_visit (_ptr, collector, nullptr)));
746+ reachabilityFence (this );
735747 return result;
736748 }
737749
@@ -754,6 +766,7 @@ class Query<T> {
754766 closed = true ;
755767 C .dartc_stream_close (cStream);
756768 port.close ();
769+ reachabilityFence (this );
757770 };
758771
759772 try {
@@ -838,10 +851,18 @@ class Query<T> {
838851 // }
839852
840853 /// For internal testing purposes.
841- String describe () => dartStringFromC (C .query_describe (_ptr));
854+ String describe () {
855+ final result = dartStringFromC (C .query_describe (_ptr));
856+ reachabilityFence (this );
857+ return result;
858+ }
842859
843860 /// For internal testing purposes.
844- String describeParameters () => dartStringFromC (C .query_describe_params (_ptr));
861+ String describeParameters () {
862+ final result = dartStringFromC (C .query_describe_params (_ptr));
863+ reachabilityFence (this );
864+ return result;
865+ }
845866
846867 /// Use the same query conditions but only return a single property (field).
847868 ///
@@ -852,7 +873,9 @@ class Query<T> {
852873 /// var results = query.property(tInteger).find();
853874 /// ```
854875 PropertyQuery <DartType > property <DartType >(QueryProperty <T , DartType > prop) {
855- final result = PropertyQuery <DartType >._(_ptr, prop._model);
876+ final result = PropertyQuery <DartType >._(
877+ C .query_prop (_ptr, prop._model.id.id), prop._model.type);
878+ reachabilityFence (this );
856879 if (prop._model.type == OBXPropertyType .String ) {
857880 result._caseSensitive = InternalStoreAccess .queryCS (_store);
858881 }
0 commit comments