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

List:       kde-commits
Subject:    [kdevelop/4.5] projectmanagers/cmake/testing: Make CTestFindJob killable to ensure it gets stopped o
From:       Milian Wolff <mail () milianw ! de>
Date:       2013-01-31 21:35:32
Message-ID: 20130131213532.B370CA6091 () git ! kde ! org
[Download RAW message or body]

Git commit 7a521fc9699a8c257baebcdfdcb7e8fd4c361ecc by Milian Wolff.
Committed on 31/01/2013 at 22:33.
Pushed by mwolff into branch '4.5'.

Make CTestFindJob killable to ensure it gets stopped on shutdown.

This should be the proper fix for the crash-on-close bug that
was encountered quite often. I do not understand how to trigger it
on startup though - can someone try with this patch again?

BUG: 309715
CCBUG: 314187

M  +9    -7    projectmanagers/cmake/testing/ctestfindjob.cpp
M  +2    -0    projectmanagers/cmake/testing/ctestfindjob.h

http://commits.kde.org/kdevelop/7a521fc9699a8c257baebcdfdcb7e8fd4c361ecc

diff --git a/projectmanagers/cmake/testing/ctestfindjob.cpp \
b/projectmanagers/cmake/testing/ctestfindjob.cpp index bf18751..81f7b28 100644
--- a/projectmanagers/cmake/testing/ctestfindjob.cpp
+++ b/projectmanagers/cmake/testing/ctestfindjob.cpp
@@ -22,7 +22,9 @@
 
 #include <interfaces/icore.h>
 #include <interfaces/itestcontroller.h>
+#include <interfaces/ilanguagecontroller.h>
 #include <language/duchain/duchain.h>
+#include <language/backgroundparser/backgroundparser.h>
 
 #include <QFileInfo>
 #include <KProcess>
@@ -34,6 +36,7 @@ CTestFindJob::CTestFindJob(CTestSuite* suite, QObject* parent)
 {
     kDebug() << "Created a CTestFindJob";
     setObjectName(i18n("Parse test suite %1", suite->name()));
+    setCapabilities(Killable);
 }
 
 void CTestFindJob::start()
@@ -45,7 +48,7 @@ void CTestFindJob::start()
 void CTestFindJob::findTestCases()
 {
     kDebug();
-    
+
     if (!m_suite->arguments().isEmpty())
     {
         KDevelop::ICore::self()->testController()->addTestSuite(m_suite);
@@ -71,11 +74,6 @@ void CTestFindJob::findTestCases()
 
 void CTestFindJob::updateReady(const KDevelop::IndexedString& document, const \
KDevelop::ReferencedTopDUContext& context)  {
-    // try not to crash, see: https://bugs.kde.org/show_bug.cgi?id=309715
-    if (KDevelop::ICore::self()->shuttingDown()) {
-        return;
-    }
-
     kDebug() << m_pendingFiles << document.str();
     m_suite->loadDeclarations(document, context);
     m_pendingFiles.removeAll(document.str());
@@ -87,4 +85,8 @@ void CTestFindJob::updateReady(const KDevelop::IndexedString& \
document, const KD  }
 }
 
-
+bool CTestFindJob::doKill()
+{
+    KDevelop::ICore::self()->languageController()->backgroundParser()->revertAllRequests(this);
 +    return true;
+}
diff --git a/projectmanagers/cmake/testing/ctestfindjob.h \
b/projectmanagers/cmake/testing/ctestfindjob.h index 571f7f9..e3cd442 100644
--- a/projectmanagers/cmake/testing/ctestfindjob.h
+++ b/projectmanagers/cmake/testing/ctestfindjob.h
@@ -43,6 +43,8 @@ private slots:
     void findTestCases();
     void updateReady(const KDevelop::IndexedString& document, const \
KDevelop::ReferencedTopDUContext& context);  
+protected:
+    virtual bool doKill();
 private:
     CTestSuite* m_suite;
     QStringList m_pendingFiles;


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

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