-RM-279-MR-Segmentation Fault caused by WQtCustomDockWidget with Multi-Threaded-Views
If you remove a module from the module-tree which uses a WQtCustomDockWidget, then there sometimes is an segmentation fault. I think the reason for this is a combination of multiple-inheritance and multithreading. The WQtCustomDockWidget inherits from WCustomWidget and WQtGLDockWidget. In the constructor it adds a WCustomWidget::WindowHandler to the event-queue stored in the WQtGLDockWidget. The problem is that after deletion of the WCustomWidget-part, there is an invalid pointer in the still existing WindowHandler, which gets deleted in the WQtGLDockWidget-part. Due to multithreading, there could be an update-traversal in between these deletions and therefore the invalid pointer could cause a segmentation-fault.
Reproducing: I reproduce this bug by simply adding and removing the same module again and again.
Possible solution: Invalidate (set NULL) the pointer stored in the WCustomWidget::WindowHandler in the destructor of the WQtCustomDockWidget. Then check this case in the WCustomWidget::WindowHandler::handle-function instead of using the pointer to the WCustomWidget. This solutions requires a setter for this pointer in the WCustomWidget::WindowHandler and a reference of the WindowHandler stored in the WQtCustomDockWidget.
(from redmine: created on 2013-04-15, closed on 2014-03-04)