|
@@ -203,9 +203,11 @@ void BroadPhase2DHashGrid::_exit_grid(Element *p_elem, const Rect2 &p_rect, bool
|
|
if (sz.width * sz.height > large_object_min_surface) {
|
|
if (sz.width * sz.height > large_object_min_surface) {
|
|
|
|
|
|
//unpair all elements, instead of checking all, just check what is already paired, so we at least save from checking static vs static
|
|
//unpair all elements, instead of checking all, just check what is already paired, so we at least save from checking static vs static
|
|
- for (Map<Element *, PairData *>::Element *E = p_elem->paired.front(); E; E = E->next()) {
|
|
|
|
-
|
|
|
|
|
|
+ Map<Element *, PairData *>::Element *E = p_elem->paired.front();
|
|
|
|
+ while (E) {
|
|
|
|
+ Map<Element *, PairData *>::Element *next = E->next();
|
|
_unpair_attempt(p_elem, E->key());
|
|
_unpair_attempt(p_elem, E->key());
|
|
|
|
+ E = next;
|
|
}
|
|
}
|
|
|
|
|
|
if (large_elements[p_elem].dec() == 0) {
|
|
if (large_elements[p_elem].dec() == 0) {
|