How to catch exception at Quitting ?

i got an Apple Crash reporter that shows me general data… i can’t find what cause the problem… (only at quitting…)
how can i catch this error in Xojo IDE ?

[quote]Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 XojoFramework 0x01be94ec RuntimeControl::ReleaseData() + 40
1 MyAPP.debug 0x000adfe0 Control.__Exit%%o + 42
2 XojoFramework 0x01c5cfc9 RuntimeUnlockObject + 840
3 XojoFramework 0x01c090e2 RowEntry::~RowEntry() + 60
4 XojoFramework 0x01c0910f RowEntry::~RowEntry() + 17
5 XojoFramework 0x01bfe0d0 RuntimeListbox::Close() + 162
6 XojoFramework 0x01c9ae96 SubPane::Unlock() + 134
7 XojoFramework 0x01c9ae96 SubPane::Unlock() + 134
8 XojoFramework 0x01c9ae72 SubPane::Unlock() + 98
9 XojoFramework 0x01c9ae96 SubPane::Unlock() + 134
10 XojoFramework 0x01c9ae96 SubPane::Unlock() + 134
11 XojoFramework 0x01b694c6 RuntimeView::UnifiedClose(bool) + 472
12 XojoFramework 0x01b5afd7 0x1a07000 + 1392599
13 XojoFramework 0x01cb587d IterateWindowList(unsigned char ()(Window, void*), void*) + 1109
14 XojoFramework 0x01b5ae6a TestApplicationQuit() + 115
15 XojoFramework 0x01b5b043 ApplicationQuit(int, unsigned char) + 22
16 XojoFramework 0x01c911a5 QuitMenuAction + 67
17 MyAPP.debug 0x00064799 QuitMenuItem.Event_Action%b%o + 42[/quote]

Hello Etienne,

Check out this thread. A solution is near the end:

https://forum.xojo.com/44293-random-crash-on-quit/p3#p369309

Ideally, you would be able to fix the problem. It looks like the code is trying to manipulate a listbox in the applications close event (which is probably way too late).

and if you are in fact referencing a control (listbox) on a window, then that window remains (or re-enters) scope again,
which will totally freak out the app, since it can never truly close

It’s something in the changed event that trigger something already gone while closing…
is there a way to stop the change event when quitting / closing the app/window ?

Keep in mind that getting (and setting) some listbox properties triggers a changed event - it can be very tricky.

Perhaps using the CancelClose event might be of help here

yes, it’s tricky ! i remove the code on the “change” event… and it’s stop crashing
if i simply put a breakpoint on the change event first line… it crash anyway, so i don’t know what the hell
and the report from an other computer for the same code is different… here :

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 XojoFramework 0x01c074ec RuntimeControl::ReleaseData() + 40 1 Kanjo.debug 0x000ae034 Control.__Exit%%o<Control> + 42 2 XojoFramework 0x01c7afc9 RuntimeUnlockObject + 840 3 XojoFramework 0x01b13be6 0x1a25000 + 977894 4 libobjc.A.dylib 0x9410bdbd objc_object::sidetable_release(bool) + 239 5 libobjc.A.dylib 0x9410d1e6 -[NSObject release] + 25 6 com.apple.AppKit 0x97aa5da1 -[NSMenuItem dealloc] + 229 7 libobjc.A.dylib 0x9410bdbd objc_object::sidetable_release(bool) + 239 8 libobjc.A.dylib 0x9410d1e6 -[NSObject release] + 25 9 libobjc.A.dylib 0x9410ab10 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 488 10 com.apple.CoreFoundation 0x93c8d33f _CFAutoreleasePoolPop + 47 11 com.apple.Foundation 0x9221bed8 -[NSAutoreleasePool drain] + 122 12 com.apple.AppKit 0x97875ad2 -[NSApplication run] + 946 13 XojoFramework 0x01c787e8 mainloop() + 46 14 XojoFramework 0x01c768f7 RuntimeRun + 49 15 Kanjo.debug 0x001abc63 REALbasic._RuntimeRun + 34 16 Kanjo.debug 0x015fee02 _Main + 295 17 Kanjo.debug 0x015f0b6a main + 36 18 Kanjo.debug 0x016322d6 start + 53

Get whatever you need when the change and other events happen while the user is interacting, so that when CancelClose comes along, you already have whatever you need from the listbox.

If there’s anything else left that won’t trigger another change event, you can get it from the listbox in the CancelClose event, and then disable it or whatever. Don’t trigger events in CancelClose, and don’t do anything at all in the Close event.

And implement the code Tim Jones recommended.

i found that if i use rowtags as a complex class, it crash. I change it to a simple integer, and no more crash