App goes into limbo

I have an app that I’m working on (Windows 10, Xojo 2019r2) that among the controls has a listbox in the main window. Running from the IDE, when I close the app using the Window’s Close button, the the app goes into limbo after the window closes. I need to hit the Resume button in the IDE for it to finally quit. However, this only happens if I have made a change in the listbox’s contents, either adding or deleting a row or changing the value of a cell. No other control, including other listboxes, results in the problem.


  1. I have no break statements or breakpoints
  2. It does not drop into the debugger, nor does there appear a stack list
  3. I put a DebugLog statement as the last line in the Window’s Closing event and a DebugLog statement as the first line if the App.Closing event and the time between them shows the time I waited until I hit the Resume button.

DebugmyBudget2: 11/11/19 11:4:37.906 : MainWin.Closing - Window Closing Start DebugmyBudget2: 11/11/19 11:4:37.912 : MainWin.Closing - Window Closing End DebugmyBudget2: 11/11/19 11:4:58.737 : App.Closing - App Closing Start
4. I do not have the CancelClosing event added to either the Window or the App.
5. I have been unable to reproduce the problem in any other of my apps but it is consistent in this one.

Where can the app be going between the end of the window closing and the start of the app closing? And how can I track it down with no debugger information?

Is a Scotch or Irish whiskey a better choice?

Fwiw I’m not keen on either :stuck_out_tongue:

Have you tried:

  • Clearing caches
  • Setting a breakpoint on the last line of Window.Close and Stepping from there

[quote=462786:@Kem Tekinay]Have you tried:

  • Clearing caches
  • Setting a breakpoint on the last line of Window.Close and Stepping from there[/quote]
    Yes to both. Clearing the caches had no effect. If I try to step out of the Window.Closing the window closes and the app goes away until I hit the Resume button; then it finishes closing. I tried putting a breakpoint at the start of the App.Closing event also and it gets hit as soon as I hit the Resume button. So it’s getting lost somewhere after the end of the Window.Closing event and the start of the App.Closing event. The Stack listing in the IDE shows “Event Loop” (which is nothing I’ve coded) which confirms that the app is still running but gives no clue as to where.

Do you have anything in the CancelClose or Close event for any window that references that window or any control on that window? If so (and you have implict instance turned on)… the window will silently “open” but may not make itself visible,

No. I don’t have any CancelClose handlers implemented. The app has only the one window and no code in the Window.Closing handler accesses any control.

I think Dave’s asking if you have a reference to the window elsewhere in the app, or a circular reference within the window itself.

Actually, I lied. In the Window.Closing event I had a reference to the listbox itself that I had put in a long time back to force the listbox out of EditCell mode when closing the window. This was needed due to an old bug in Xojo that would crash an app if the window closed while EditCell was active. Taking that line out in the 2019r2 version of the program seems to fix the problem. Since Xojo apparently fixed the bug that had required it, I hope it’s golden.

Interestingly, the version of the app for 2019r1.1 and earlier doesn’t manifest the problem even though the problematic line is still in the code.

Yes… that Listbox was exactly the type of reference I was referring to :slight_smile:

If you need to put that back, use the CancelClose event.

So, for a bit more details, the bug in question feedback://showreport?report_id=52488 was what the “fix” was to work around. At the time, about a year and a half ago, I had put the fix in the Window.Close handler.

Right, I moved it there this morning and my templates all have it there but this app was created before I bothered to make the templates…old code.