Sorry, forgot to create a log like you suggested, but since you seem to be back did you possibly have a look...?
I meant "I can have a look at the log file". This is in case gdb reports any error, but the error is hidden by the IDE.
If there is a detect-able error, then there may be a way to deal with it. At least make sure it is reported to the user. If not, then this is more complicated. (I do not have Ubuntu, and the problem does not happen on my (older) Fedora).
The gdb based debugger also has an option to skip loading library symbols => worth a try....
Btw, not sure if any relationship at all, but there is another thread mentioning issues on Ubuntu:
https://forum.lazarus.freepascal.org/index.php/topic,51407.0.html.
About the crash during app-closing: label gets destroyed first (at least for me), so accessing it crashes. However this crash does not manifest always. ( It can be forced by -gh ).
Crashes during app-close are not always (visible) reported. On windows, I can see the crash outside the debugger, if I run with a console, as it is printed out. The app closes however before it can report it via gui.
IMHO it is "unfortunate" that the collapse/expand event is called during destroy, maybe that should be changed, but that is a diff topic.