Destroy not started debug sessions
When a debug session is stopped via MIDebugSession::stopDebugger() and discarded while the s_dbgNotStarted state is still on, the session is never destroyed. This is a genuine resource leak because the number of such unused but not destroyed debug sessions is unlimited. The leak can be easily reproduced by triggering Debug Launch with a nonexistent executable specified in the current launch configuration. A more difficult way to reproduce the leak is to Debug-Launch many times in quick succession: some sessions will never reach MIDebugSession::startDebugging() and debug-print the following line: kdevelop.plugins.debuggercommon: Stopping debugger when it's not started The leak is already detected in MIDebugSession::stopDebugger() when the aforementioned message is debug-printed. Let us set the session state to EndedState there. This session state change is connected to DebugController::debuggerStateChanged(), which calls deleteLater() on the debug session.
Showing with 13 additions and 3 deletions