Branch 'kolab/integration/4.13.0' - 2 commits - akonadi/changerecorder.cpp akonadi/changerecorder_p.cpp akonadi/changerecorder_p.h akonadi/monitor_p.cpp

Christian Mollekopf mollekopf at kolabsys.com
Mon Jan 5 23:02:58 CET 2015


 akonadi/changerecorder.cpp   |    6 +-----
 akonadi/changerecorder_p.cpp |   12 ++++++++++++
 akonadi/changerecorder_p.h   |    1 +
 akonadi/monitor_p.cpp        |    8 ++++++++
 4 files changed, 22 insertions(+), 5 deletions(-)

New commits:
commit b83eee7df3cf26b4051ae40acfa8a17141a04e8c
Author: Christian Mollekopf <chrigi_1 at fastmail.fm>
Date:   Mon Jan 5 21:05:28 2015 +0100

    Don't get stuck when we fail to fetch tags or relations of a notification.

diff --git a/akonadi/monitor_p.cpp b/akonadi/monitor_p.cpp
index 52b9114..9b7958a 100644
--- a/akonadi/monitor_p.cpp
+++ b/akonadi/monitor_p.cpp
@@ -1090,6 +1090,10 @@ bool MonitorPrivate::emitTagsNotification(const NotificationMessageV3 &msg, cons
         validTags = tags;
     }
 
+    if (validTags.isEmpty()) {
+        return false;
+    }
+
     switch (msg.operation()) {
     case NotificationMessageV2::Add:
         if (q_ptr->receivers(SIGNAL(tagAdded(Akonadi::Tag))) == 0) {
@@ -1126,6 +1130,10 @@ bool MonitorPrivate::emitRelationsNotification(const NotificationMessageV3 &msg,
 {
     Q_ASSERT(msg.type() == NotificationMessageV2::Relations);
 
+    if (relations.isEmpty()) {
+        return false;
+    }
+
     switch (msg.operation()) {
     case NotificationMessageV2::Add:
         if (q_ptr->receivers(SIGNAL(relationAdded(Akonadi::Relation))) == 0) {


commit 5c8d653ec8b6cc3359a1306b70d31eb0c1ea5b77
Author: Christian Mollekopf <chrigi_1 at fastmail.fm>
Date:   Mon Jan 5 21:03:10 2015 +0100

    ChangeRecorder: Don't get stuck on invalid notifications.
    
    This is a manual partial revert of
    a22afe7: Fixed endless loop in changerecorder with unhandled notifications.
    
    The previous patch failed to skip over notifications that fail to be emitted in the translateAndCompress branch of replayNext.
    This resulted in stuck resources. We still have to keep the dequeueNotification to
    avoid endlessly replaying the same broken notification.

diff --git a/akonadi/changerecorder.cpp b/akonadi/changerecorder.cpp
index 5e73b78..5851659 100644
--- a/akonadi/changerecorder.cpp
+++ b/akonadi/changerecorder.cpp
@@ -65,11 +65,7 @@ void ChangeRecorder::replayNext()
     if (!d->pendingNotifications.isEmpty()) {
         const NotificationMessageV3 msg = d->pendingNotifications.head();
         if (d->ensureDataAvailable(msg)) {
-            if (!d->emitNotification(msg)) {
-                //If no signal was emitted (e.g. because noone was connected to it), noone is going to call changeProcessed, so we help ourselves
-                d->dequeueNotification();
-                return replayNext();
-            }
+            d->emitNotification(msg);
         } else if (d->translateAndCompress(d->pipeline, msg)) {
             // The msg is now in both pipeline and pendingNotifications.
             // When data is available, MonitorPrivate::flushPipeline will emitNotification.
diff --git a/akonadi/changerecorder_p.cpp b/akonadi/changerecorder_p.cpp
index 54eb240..d4f0c92 100644
--- a/akonadi/changerecorder_p.cpp
+++ b/akonadi/changerecorder_p.cpp
@@ -490,3 +490,15 @@ void ChangeRecorderPrivate::notificationsLoaded()
     m_lastKnownNotificationsCount = pendingNotifications.count();
     m_startOffset = 0;
 }
+
+bool ChangeRecorderPrivate::emitNotification(const Akonadi::NotificationMessageV3 &msg)
+{
+    const bool someoneWasListening = MonitorPrivate::emitNotification(msg);
+    if (!someoneWasListening && enableChangeRecording) {
+        //If no signal was emitted (e.g. because no one was connected to it), no one is going to call changeProcessed, so we help ourselves.
+        dequeueNotification();
+        QMetaObject::invokeMethod(q_ptr, "replayNext", Qt::QueuedConnection);
+    }
+    return someoneWasListening;
+}
+
diff --git a/akonadi/changerecorder_p.h b/akonadi/changerecorder_p.h
index 408be91..9544cf1 100644
--- a/akonadi/changerecorder_p.h
+++ b/akonadi/changerecorder_p.h
@@ -43,6 +43,7 @@ public:
     virtual void notificationsErased();
 
     virtual void slotNotify(const NotificationMessageV3::List &msgs);
+    virtual bool emitNotification(const Akonadi::NotificationMessageV3& msg);
 
     QString notificationsFileName() const;
 




More information about the commits mailing list