fix(ci): SightViewer GUI tests seem to crash frequently
Description
SightViewer GUI tests seem to crash quite frequently lately.
It seems that crashes happen at a very specific position: when verifying whether the file dialog is closed. See the logs of https://git.ircad.fr/sight/sight/-/jobs/822025 for example. It might be possible that the file dialog is destroyed before checking fileDialog->isClosed()
, thus it operates on a dangling pointer, leading to a crash.
Steps to reproduce
Look at the pipelines which failed because of SightViewer GUI crashes.
Functional specifications
SightViewer GUI tests crash less often.
Technical specifications
Change Tester::m_graphicComponent from a raw pointer to a QPointer, so that it automatically becomes a null pointer when the targeted object is destroyed. The test will simply and gracefully fail if trying to access an expired graphic component.
Use a QPointer when taking a pointer for later use in GUI tests in situation where the widget it points to might be destroyed before it is accessed (typically dialog windows, as file dialogs).
Test plan
The crashes happen less often.