[Akonadi] [Bug 362420] DAV Resource 16.08.0: Segfaults randomly

NightSky bugzilla_noreply at kde.org
Sun Dec 18 12:31:43 GMT 2016


https://bugs.kde.org/show_bug.cgi?id=362420

NightSky <risimirox at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |risimirox at gmail.com

--- Comment #2 from NightSky <risimirox at gmail.com> ---
Same here on Gentoo Linux, kde-frameworks-5.29, kde-applications-16.12.0 with
similar stack trace.

According to the stack trace:
    EtagCache::setEtag (this=__0x0__, remoteId=..., etag=...)
    DavGroupwareResource::onItemFetched(...)
it looks like DavGroupwareResource::onItemFetched() is got a nullptr instead of
EtagCache*.

Relevant lines from davgroupwareresource.cpp:
    956:    // update etag
    957:    item.setRemoteRevision(davItem.etag());
    958:>>> EtagCache *etag = mEtagCaches[collection.remoteId()]; <<<
    959:    etag->setEtag(item.remoteId(), davItem.etag());

If collection.remoteId() is not in the mEtagCaches, the etag pointer will be
initialized to null.
    ( https://doc.qt.io/qt-5.7/qmap.html#operator-5b-5d )
    ( https://doc.qt.io/qt-5.7/containers.html#default-constructed-value )

I don't really know what the DavGroupwareResource should do in such case, so
meanwhile I just copy pasted a relevant check from another DavGroupwareResource
method (see below).
And now, instead of the segfault I get an "org.kde.pim.davresource: Fetched
item is in a collection we don't have in the cache" in the logs, each time I
open KOrganizer.

Hope that helps.

 - - -  - - - - - - - - - - - - - - - - - - - - - - - - ->8
diff --git a/resources/dav/resource/davgroupwareresource.cpp
b/resources/dav/resource/davgroupwareresource.cpp
--- a/resources/dav/resource/davgroupwareresource.cpp
+++ b/resources/dav/resource/davgroupwareresource.cpp
@@ -955,6 +955,14 @@

     // update etag
     item.setRemoteRevision(davItem.etag());
+
+    if (!mEtagCaches.contains(collection.remoteId())) {
+        qCWarning(DAVRESOURCE_LOG) << "Fetched item is in a collection we
don't have in the cache";
+        // TODO: fix #362420 "DAV Resource 16.08.0: Segfaults randomly"
+        cancelTask();
+        return;
+    }
+
     EtagCache *etag = mEtagCaches[collection.remoteId()];
     etag->setEtag(item.remoteId(), davItem.etag());

8< - -  - - - - - - - - - - - - - - - - - - - - - - - - - -

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Kdepim-bugs mailing list