Summary: | Crash in ParseProjectJob::start() when exiting KDevelop soon after a large project is opened | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | Igor Kushnir <igorkuo> |
Component: | general | Assignee: | Igor Kushnir <igorkuo> |
Status: | RESOLVED FIXED | ||
Severity: | crash | ||
Priority: | NOR | ||
Version: | git master | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/kdevelop/kdevelop/commit/0b037a8cccc80018e5c7d679a9127b0f806aa926 | Version Fixed In: | 5.6.1 |
Description
Igor Kushnir
2020-10-06 12:34:20 UTC
Git commit 0b037a8cccc80018e5c7d679a9127b0f806aa926 by Igor Kushnir. Committed on 07/10/2020 at 10:11. Pushed by igorkushnir into branch '5.6'. Kill ParseProjectJob before closing its project Remove the now redundant deleting of the ParseProjectJob when its project is destroyed. ParseProjectJob objects are created in ProjectController::reparseProject(), which is called when the project is already fully open. So the project is guaranteed to be closed before it is destroyed. A Project is destroyed via deleteLater() after it is closed, so if the event loop is busy at the time, &IProject::destroyed can be emitted much later than IProjectController::projectClosing(). With this commit ParseProjectJob is killed earlier than it was destroyed without the commit. Early-return from ParseProjectJob::queueFilesToParse() not only when the job has been destroyed, but when it has been killed too. The earlier return not just avoids unnecessary work, but is essential during the application shutdown: prevents a crash by not accessing IndexedString after DUChain::shutdown(). Note that KJob::kill() calls deleteLater(), so a job can be destroyed a long time after it is killed if the event loop is busy, as it is at shutdown. ParseProjectJob is killed early in the shutdown process from RunController::cleanup() - before ProjectController::cleanup(), which would kill it otherwise, and (importantly to prevent the crash) before DUChain::shutdown(). Remove the shuttingDown() check from ParseProjectJob::start(), because this member function doesn't access globals on its own. The appropriate safety checks are now performed in the scheduled ParseProjectJob::queueFilesToParse(). Don't call deleteLater() in ParseProjectJob::doKill() just before returning true: rely on auto-delete KJob base class to call it. FIXED-IN: 5.6.1 M +24 -13 kdevplatform/language/backgroundparser/parseprojectjob.cpp M +0 -3 kdevplatform/language/backgroundparser/parseprojectjob.h M +3 -0 kdevplatform/shell/projectcontroller.cpp https://invent.kde.org/kdevelop/kdevelop/commit/0b037a8cccc80018e5c7d679a9127b0f806aa926 |