Closed DerekVeit closed 1 day ago
Forget it myself. Please add a line to the CHANGES file. Something like this:
fix(gui): Fix Qt segmentation fault with uninstall ExtraMouseButtonEventFilter when closing main window (#1095)
Thanks, Christian. I hope I understood correctly. I amended that to the previous commit. Feel free to point out anything I do not quite right. I'll be happy to revise again. I hope to be making more contributions.
I used your script and confirm it might work. With your fix I can start-stop BIT 1000 times without seg fault. But without the fix I do have ~50% of seg faults.
I tried it with and without the fix on a few different versions, with Python 3.8, 3.10, 3.12 and BIT 1.2.1, 1.3.2, 1.4.3, 1.4.4-dev (not every combination). I didn't keep statistics, but without the fix, I got segfaults roughly half the time except with 1.4.4-dev and Qt6. With the Qt6 build, the segfaults were much less frequent but did still happen.
It seems there must be some race in the QApplication destruction that determines whether it will have the segfault, and that timing is a bit different with my Qt6 build. Little things, like whether files are in cache, seem to affect it.
But with the fix, I never got a segfault on any version.
Fix #1095