[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdevplatform] shell: Add warning output when a non-killable job is registered.
From:       Milian Wolff <mail () milianw ! de>
Date:       2013-01-31 21:37:24
Message-ID: 20130131213724.E0D80A60C8 () git ! kde ! org
[Download RAW message or body]

Git commit 1307ce987adfbf7bdc5738a64040aa14079ad11e by Milian Wolff.
Committed on 31/01/2013 at 22:36.
Pushed by mwolff into branch 'master'.

Add warning output when a non-killable job is registered.

Bug 314187 clearly shows how that can lead to nasty crashes quite
easily so I think we should enforce a "only killable jobs" policy
for the run controller.

Note: The import job is not killable which also is a known problem.

M  +9    -1    shell/runcontroller.cpp

http://commits.kde.org/kdevplatform/1307ce987adfbf7bdc5738a64040aa14079ad11e

diff --git a/shell/runcontroller.cpp b/shell/runcontroller.cpp
index 6284b4d..750c879 100644
--- a/shell/runcontroller.cpp
+++ b/shell/runcontroller.cpp
@@ -551,6 +551,11 @@ void KDevelop::RunController::registerJob(KJob * job)
     if (!job)
         return;
 
+    if (!(job->capabilities() & KJob::Killable)) {
+        // see e.g. https://bugs.kde.org/show_bug.cgi?id=314187
+        kWarning() << "non-killable job" << job << "registered - this might lead to \
crashes on shutdown."; +    }
+
     if (!d->jobs.contains(job)) {
         KAction* stopJobAction = 0;
         if (Core::self()->setupFlags() != Core::NoUi) {
@@ -624,8 +629,11 @@ void KDevelop::RunController::stopAllProcesses()
         // now we check the real list whether it was deleted
         if (!d->jobs.contains(job))
             continue;
-        if (job->capabilities() & KJob::Killable)
+        if (job->capabilities() & KJob::Killable) {
             job->kill(KJob::EmitResult);
+        } else {
+            kWarning() << "cannot stop non-killable job: " << job;
+        }
     }
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic