Bug 394104 - Warning that previous program is still running even if build failed
Summary: Warning that previous program is still running even if build failed
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: CPP Debugger (show other bugs)
Version: 5.10.221180
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-10 18:47 UTC by Rolf Eike Beer
Modified: 2023-01-20 11:10 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.11.230400
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf Eike Beer 2018-05-10 18:47:35 UTC
-set up everything that you can debug a program
-intentionally introduce a syntax error in your program
-hit Alt-F9 -> compilation will fail
-fix it, hit Alt-F9
-> warning that previous instance is still running, even if it never was started.
Comment 1 Justin Zobel 2022-11-21 08:22:01 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 2 Rolf Eike Beer 2022-11-21 09:26:58 UTC
still happens
Comment 3 Igor Kushnir 2023-01-20 11:10:27 UTC
Git commit f051c8e3df8bf5ca9e8f8572d324900db316001e by Igor Kushnir.
Committed on 20/01/2023 at 09:55.
Pushed by igorkushnir into branch 'master'.

Don't leak the debug session if a debug job finishes in destructor

The constructor of a MI debug job creates a debug session. A debug
session emits finished() and is destroyed when it finishes. A MI debug
job finishes normally when its debug session emits finished(). When a MI
debug job is killed, it calls MIDebugSession::stopDebugger(), which
finishes the debug session. However, when a MI debug job is destroyed
before it starts running, the debug session is leaked. A job should
never leak resources, no matter when or how it is destroyed.

If a MIDebugJob has a dependency, GdbLauncher::start() adds the
MIDebugJob as the second subjob of an ExecuteCompositeJob. If an
ExecuteCompositeJob is configured to abort on error (which is the
default and almost always the case), when a subjob finishes with an
error, the remaining subjobs are never started, the composite job
finishes and is soon destroyed. The remaining subjobs are owned by the
composite job and are destroyed along with it. This scenario happens
when a MIDebugJob job depends on a build job, and the build job fails,
e.g. because of a syntax error in the program. Without this commit, the
job's debug session is not destroyed and the Debug area remains active
in KDevelop then.

ExecuteCompositeJob::doKill() does not kill the remaining subjobs if
killing a subjob fails. Since ExecuteCompositeJob is a parent of its
subjobs, the not-killed subjobs are eventually destroyed along with it.
Furthermore, I believe that not-started subjobs should always be simply
destroyed rather than killed, and plan to implement this change soon.
FIXED-IN: 5.11.230400

M  +11   -0    plugins/debuggercommon/midebugjobs.cpp
M  +1    -0    plugins/debuggercommon/midebugjobs.h

https://invent.kde.org/kdevelop/kdevelop/commit/f051c8e3df8bf5ca9e8f8572d324900db316001e