Ok, most likely this is not a match to the issue here. I throw it in anyway. Just in case....
There is an issue (apparently mainly) with modal forms: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41041
File dialogs are modal. Depending on the Windowmanager, and the exact versions of whatever libraries are involved => its possible that its triggering this.
My - frankly extremely limited - understanding is, that in most cases the routines in gtk recognize the wrong data, and give some error and think work out. But, that isn't guaranteed.
Another approach might be: valgrind. (if that is avail for arch)
If by any chance any data is freed or uninitialized, then valgrind may identify that, even if the access to it happens deep in gtk. But, you also will get a lot of noise, as in most cases gtk itself triggers warnings.
I'm afraid you may be correct.
Our QA ran additional tests on x86_64 Linux platforms with GTK2 and Qt5, and we ran into similar issues, lockups, freezes across some choice variants:
aarch64 GTK2 Ubuntu & Kali: Random freezes, which happen when you, for example, cancel out of some modal dialogs (not even common file dialogs) we show on our own; but don't happen when you take other actions (completing the modal dialog actions) without cancelling them.
x86_64 Qt5 Centos, Fedora: Random crashes after a common file dialog is shown successfully - whereby the entire app immediately terminates. To be fair, the workaround code above was only implemented for the
aarch64 platform, so it may have prevented these issues as well. We're doing further testing to clarify.
At any rate, running Lazarus itself on affected platforms consistently reproduces the issues, sooner or later (ex: you can just delve into the Lazarus settings dialog, and/or use its standard file dialog boxes, to easily reproduce the crashes as mentioned earlier).
The problems also tend to reproduce with more complex projects, and can be somehow far more elusive in simpler projects.
I realize all of this is anecdotal evidence so please by all means feel free to treat it as such, I am primarily just confirming
Martin_fr's suspicions here.