Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
KDevelop
KDevelop
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 30
    • Merge Requests 30
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • KDevelop
  • KDevelopKDevelop
  • Merge Requests
  • !173

Merged
Opened Oct 05, 2020 by Igor Kushnir@igorkushnirDeveloper

Don't invoke BackgroundParser::parseComplete() twice on failure

  • Overview 0
  • Commits 1
  • Pipelines 2
  • Changes 1

When a job fails, ThreadWeaver::QObjectDecorator emits both failed() and done() signals. BackgroundParser::parseComplete() is connected to both. So when a ParseJob fails, parseComplete() is called twice for the same job. The most obvious consequence is the too great value of d->m_doneParseJobs.

Two classes derived from ParseJob - CMakeParseJob and QmlJsParseJob - call ParseJob::abortJob() when they are aborted, which makes ParseJob::success() return false and thus causes QObjectDecorator to emit both signals.

In order to test what happens when the bug is triggered, I edited CMakeParseJob::run() code to unconditionally call abortJob(); return; after the if (!package.isEmpty()) { line. KDevelop seems to handle this well, but there are lots of relevant debug messages in the log:

kdevplatform.language: m_doneParseJobs larger than m_maxParseJobs: 0 -1
kdevplatform.language: m_doneParseJobs larger than m_maxParseJobs: 1 0

The simple fix is to connect only to the &ThreadWeaver::QObjectDecorator::done signal. Its documentation states:

"This signal is emitted when the job has been finished (no matter if it succeeded or not)."

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Reference: kdevelop/kdevelop!173
Source branch: no-duplicate-backgroundparser-parsecomplete