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

List:       kde-commits
Subject:    branches/KDE/4.2/kdelibs/plasma
From:       Jacopo De Simoi <wilderkde () gmail ! com>
Date:       2009-03-04 21:05:26
Message-ID: 1236200726.106122.867.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 935345 by jacopods:

"And they lived happily ever after with no more duplicate matches =)"
A local copy of the context is now created in the FindMatchesJob ctor, not anymore in \
AbstractRunner, this prevents old queries to be run with a valid dptr


 M  +2 -3      abstractrunner.cpp  
 M  +5 -5      runnermanager.cpp  


--- branches/KDE/4.2/kdelibs/plasma/abstractrunner.cpp #935344:935345
@@ -132,14 +132,13 @@
 {
 }
 
-void AbstractRunner::performMatch(Plasma::RunnerContext &globalContext)
+void AbstractRunner::performMatch(Plasma::RunnerContext &localContext)
 {
     static const int reasonableRunTime = 1500;
     static const int fastEnoughTime = 250;
 
     d->runtime.restart();
-//TODO :this is a copy ctor
-    RunnerContext localContext(globalContext, 0);
+    
     match(localContext);
     // automatically rate limit runners that become slooow
     const int runtime = d->runtime.elapsed();
--- branches/KDE/4.2/kdelibs/plasma/runnermanager.cpp #935344:935345
@@ -144,7 +144,7 @@
 protected:
     void run();
 private:
-    Plasma::RunnerContext *m_context;
+    Plasma::RunnerContext m_context;
     Plasma::AbstractRunner *m_runner;
     bool m_stale;
 };
@@ -152,7 +152,7 @@
 FindMatchesJob::FindMatchesJob(Plasma::AbstractRunner *runner,
                                Plasma::RunnerContext *context, QObject *parent)
     : ThreadWeaver::Job(parent),
-      m_context(context),
+      m_context(*context, 0),
       m_runner(runner),
       m_stale(false)
 {
@@ -165,7 +165,7 @@
 {
 //     kDebug() << "Running match for " << m_runner->objectName()
 //              << " in Thread " << thread()->id() << endl;
-    m_runner->performMatch(*m_context);
+    m_runner->performMatch(m_context);
 }
 
 int FindMatchesJob::priority() const
@@ -501,8 +501,8 @@
         //kDebug() << "ignored!";
         return false;
     }
-
-    r->performMatch(d->context);
+    RunnerContext localContext(d->context, 0);
+    r->performMatch(localContext);
     //kDebug() << "succeeded with" << d->context.matches().count() << "results";
     emit matchesChanged(d->context.matches());
     return true;


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

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