From f13236a29d7a42c54f0238ce22c699f24be803fb Mon Sep 17 00:00:00 2001 From: Yota Hamada Date: Wed, 28 Aug 2024 21:41:51 +0900 Subject: [PATCH] Fix minor bug --- query.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/query.go b/query.go index c1673c9..805ef6b 100644 --- a/query.go +++ b/query.go @@ -65,7 +65,6 @@ func (q *OrderedQuery[T]) IterOrdered(w World, orderBy *ComponentType[T]) iter.S for iter.HasNext() { archetype := iter.Next() archetype.Lock() - defer archetype.Unlock() ents := archetype.Entities() entrIter := NewOrderedEntryIterator(0, w, ents, orderBy) @@ -73,10 +72,13 @@ func (q *OrderedQuery[T]) IterOrdered(w World, orderBy *ComponentType[T]) iter.S e := entrIter.Next() if e.entity.IsReady() { if !yield(e) { + archetype.Unlock() return } } } + + archetype.Unlock() } } }