# Unresponsive Main Window After Closing Child

**URL:** <https://clarionhub.com/t/unresponsive-main-window-after-closing-child/8197>\
**Category:** questions\
**Tags:** c11, threads\
**Created:** [May 20, 2025, 2:52pm UTC](https://clarionhub.com/t/unresponsive-main-window-after-closing-child/8197 "2025-05-20T14:52:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![donridley](https://clarionhub.com/user_avatar/clarionhub.com/donridley/32/1459_2.png) [@donridley](https://clarionhub.com/u/donridley)\
**Post date:** [May 20, 2025, 2:52pm UTC](https://clarionhub.com/t/unresponsive-main-window-after-closing-child/8197/1 "2025-05-20T14:52:35Z")

</div>

Clarion 11.1.0.13855  
ABC

I have an SDI/Generic "Main" Window where I call another SDI Window like:

```auto
If Not Glo:SomeThreadNumber
	Glo:SomeThreadNumber = START(MyChildWindow,,Param1,Param2)
End

```

In the MyChildWindow's ThisWindow.Kill method I set Glo:SomeThreadNumber to 0.

Issue:

After closing the child window, when I attempt to close the main window, the main window becomes "unresponsive" and I have to kill it with the Task Manager.

I have checked, rechecked, and triple checked that I do not have some infinite LOOP going on (At least in my code.)

Does anyone have any suggestions or experience with something like this?

Thank you!

---

<div class="post-metadata">

**Author:** ![Rick\_UpperPark](https://clarionhub.com/user_avatar/clarionhub.com/rick_upperpark/32/346_2.png) [@Rick\_UpperPark](https://clarionhub.com/u/Rick_UpperPark)\
**Post date:** [May 20, 2025, 3:09pm UTC](https://clarionhub.com/t/unresponsive-main-window-after-closing-child/8197/2 "2025-05-20T15:09:21Z")

</div>

What is the CPU Usage? Is it high?  
You can compile in debug and then use the debugger to attached to the running process and view the Thread list and break into the running thread to see where it is in the code.

The check if Glo:SomeThreadNumber is non-zero before starting the new thread doesn’t make sense to me. What sets Glo:SomeThreadNumber in the first place so it is non-zero?

---

<div class="post-metadata">

**Author:** ![donridley](https://clarionhub.com/user_avatar/clarionhub.com/donridley/32/1459_2.png) [@donridley](https://clarionhub.com/u/donridley)\
**Post date:** [May 20, 2025, 3:13pm UTC](https://clarionhub.com/t/unresponsive-main-window-after-closing-child/8197/3 "2025-05-20T15:13:00Z")

</div>

You’re thinking what I was thinking.

Some mysterious infinite Loop somewhere would likely cause an increase in CPU usage.

However, CPU usage is actually Zero. Very weird.

START is setting Glo:SomeThreadNumber.

---

<div class="post-metadata">

**Author:** ![Rick\_UpperPark](https://clarionhub.com/user_avatar/clarionhub.com/rick_upperpark/32/346_2.png) [@Rick\_UpperPark](https://clarionhub.com/u/Rick_UpperPark)\
**Post date:** [May 20, 2025, 3:13pm UTC](https://clarionhub.com/t/unresponsive-main-window-after-closing-child/8197/4 "2025-05-20T15:13:51Z")

</div>

But you’re checking if it isn’t zero before you call Start.

---

<div class="post-metadata">

**Author:** ![donridley](https://clarionhub.com/user_avatar/clarionhub.com/donridley/32/1459_2.png) [@donridley](https://clarionhub.com/u/donridley)\
**Post date:** [May 20, 2025, 3:16pm UTC](https://clarionhub.com/t/unresponsive-main-window-after-closing-child/8197/5 "2025-05-20T15:16:10Z")

</div>

I had a typo in my original post.

This:

```auto
If Glo:SomeThreadNumber
    Glo:SomeThreadNumber = START(MyChildWindow,,Param1,Param2)
End

```

Should’ve been:

```auto
If Not Glo:SomeThreadNumber
    Glo:SomeThreadNumber = START(MyChildWindow,,Param1,Param2)
End

```

---

<div class="post-metadata">

**Author:** ![seanh](https://clarionhub.com/letter_avatar_proxy/v4/letter/s/4af34b/32.png) [@seanh](https://clarionhub.com/u/seanh)\
**Post date:** [May 21, 2025, 12:37am UTC](https://clarionhub.com/t/unresponsive-main-window-after-closing-child/8197/6 "2025-05-21T00:37:17Z")

</div>

Is the child window actually closed and the procedure ended?  
Having a rogue thread somewhere will cause that sort of behaviour.

---

<div class="post-metadata">

**Author:** ![donridley](https://clarionhub.com/user_avatar/clarionhub.com/donridley/32/1459_2.png) [@donridley](https://clarionhub.com/u/donridley)\
**Post date:** [May 21, 2025, 12:24pm UTC](https://clarionhub.com/t/unresponsive-main-window-after-closing-child/8197/7 "2025-05-21T12:24:43Z")

</div>

Update.

So I eliminated the symptom although I am not sure what exactly caused it.

After traveling down the rabbit hole I found that I was calling a procedure in another DLL (This is a multi-dll app.). The called procedure simply returns a string after a few calculations.

Assuming the code in the called procedure is valid, I am not sure why calling a procedure in a different thread, in another DLL, would cause a problem.

Anyway, for now everything is good to go.

Thank you to everyone provided help on this!

---

<div class="post-metadata">

**Author:** ![seanh](https://clarionhub.com/letter_avatar_proxy/v4/letter/s/4af34b/32.png) [@seanh](https://clarionhub.com/u/seanh)\
**Post date:** [May 21, 2025, 11:31pm UTC](https://clarionhub.com/t/unresponsive-main-window-after-closing-child/8197/8 "2025-05-21T23:31:48Z")

</div>

You wouldn’t happen to have cyclic references between dlls would you?  
While they don’t usually cause problems they certainly can, and some of the problems are just weird.
