# IllegalLockingException when using ObjectIterator

**URL:** <https://forum.xojo.com/t/illegallockingexception-when-using-objectiterator/88931>\
**Category:** Web\
**Created:** [September 25, 2026, 12:06pm UTC](https://forum.xojo.com/t/illegallockingexception-when-using-objectiterator/88931 "2026-09-25T12:06:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [September 25, 2026, 12:06pm UTC](https://forum.xojo.com/t/illegallockingexception-when-using-objectiterator/88931/1 "2026-09-25T12:06:22Z")

</div>

Hello, we made a little admin webpage to monitor object leaks. But when we query IterateObjects, we get a IllegalLockingException. Like if inside IterateObjects the code may go to a different thread, so the CriticalSection ends up in the iterator instead of getting freed there?

 ![Screenshot 2026-09-25 at 14.01.36](https://forum.xojo.com/uploads/default/original/3X/0/a/0a9f02cb259f158d125a40e19e09c716679c7307.jpeg)
