[Differential] [Updated] D2792: fix KDevelop::JobStatus for "short-lived" jobs

antonanikin (Anton Anikin) noreply at phabricator.kde.org
Wed Sep 21 05:46:57 UTC 2016

antonanikin added a comment.

  Ok, lets I describe the original problem "step by step".
  We have some `KJob` and associated `JobStatus`. Job do some work and can send signals, handled by `JobStatus`. We have two main scenarios:
  1. Job do it's work and **send** `percent` signals. After recieving first `percent` signal from our job `StatusbarProgressWidget` starts internal timer (1000 ms.) - during this delay widget blocks progress showing. If after this timeout our job is still in "live" state, widget popups progress bar and update it's status with new `percent` signals. When our job finished `JobStatus` obect send `hideProgress` signal, which causes starting second internal timer in `StatusbarProgressWidget` (for 5000 ms.), after which progress bar is hided. The key point here - time interval between first `percent` signal and `hideProgress` signal - if it less than 1000 ms. we don't see any progress status (blocked by `StatusbarProgressWidget`).
  2. Job do it's work **and don't send** `percent` signals. After it's finishing the `JobStatus` object emit `hideProgress` signal and therefore we don't see any progress.
  This patch tries to fix described problem. If job send `percent` signal `JobStatus` starts internal timer and blocks emitting of `hideProgress` before timer finished. If job don't send `percent` signal `JobStatus` emit such signal at `slotFinished` and after starts timer.
  This approach allows to show resulting status in any case. The key idea - provide delay between first `percent` signal and “final” `hideProgress` signal. The ugly place is using //magic constant// for delay, but `StatusbarProgressWidget` don't provide any mechanisms to avoid this.


> mwolff wrote in jobstatus.cpp:58
> why change this? undo please


> mwolff wrote in jobstatus.h:65
> unrelated change which introduces a memory leak - undo

`JobStatusPrivate` now is QObject and created as child of `JobStatus` object - there should be no memory leaks.




To: mwolff, kfunk, antonanikin
Cc: mwolff, kdevelop-devel, #kdevelop
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20160921/77efeacc/attachment-0001.html>

More information about the KDevelop-devel mailing list