gitwidget: track living git processes
When playing with session storage, I was trying to figure out, why the session_manager_test
and sessions_action_test
segfaults even on master.
Seems that even for tests the session reload will trigger default plugins reload including the project plugin and its GitWidget. The project plugin will trigger GitWidget::getStatus
and the QProcess and lambda referencing GitWidget is created.
When the GitWidget is destroyed while there is still any git QProcess arround, the exit signal will be delivered to lambda with invalid closure.
Function calls looks something like this:
- ~GitWidget
- ~QWidget
- QWidget::deleteChildren
- ~QProcess
- emit QProcess::finished
- call finished lambda referencing already destroyed GitWidget
See attached trace trace.txt
Options I have come up with:
- remove the tests (unprofessional)
- disable plugin loading during test (easy, but it creates different path in production and test)
- track created QProcesses and destroy them before the referenced GitWidget is destroyed
Since this race can in theory happen in regular kate application, I have voted for third option.