Fix/segfaults
Description
This MR fixes the teardown of BECWidgets, in particular widgets that rely on pyqtgraph. In the past, resources allocated within widgets were not properly shut down. Furthermore, pytest-qt's logic of using the qtapp as a session fixture, further lead to resources being not being released, causing segmentation faults quite regularly.
To alleviate the debugging in the future, an auto-use fixture will now check for uncleaned resources after finishing the test, ensuring that widgets are properly shut down.
Related Issues
- maybe related to #246 (closed) (to be confirmed)
- closes #276 (closed)
Type of Change
- Added cleanup method where necessary to tear down qt resources.
Additional Comments
- When you want to clean a qt resource, always use
close+deleteLater. Justcloseisn't reliably freeing the resources. I've also noticed a slight discrepancy between pyside and pyqt, so better save than sorry... - There is no need to call
closeafter yielding a widget in a fixture. In fact, the additionalclosecould lead to problems in the teardown due to already freed resources. However, the widget must be added to qtbot usingaddWidget.
Definition of Done
-
Documentation is up-to-date.