[Kde-pim] resource crashes using deleted attribute

Daniel Vrátil dvratil at kde.org
Sun Apr 12 08:45:19 BST 2015


On Sunday, April 12, 2015 01:27:42 AM David Faure wrote:
> http://www.davidfaure.fr/2015/attribute-crash is a valgrind log of a crash
> in my akonadi resource.
> 
> Could there be a bug in the refcounting of Entity / Collection / Attribute?
> Somehow the ItemCreateJob destructor (indirectly) deletes the attribute in a
> collection that a CollectionModifyJob (which is still running) is using.
> 
> How could this happen?

Hi,

my only guess is that the problem could be in Entity copy ctor, which is 
employing some kind of hack to copy the shared Private data, but I don't 
really understand it much.

Dan

> 
> 
> My code is pretty standard I think:
> 
>      // Store timestamp into DB, to persist it across restarts
>             EntityAnnotationsAttribute *annotationsAttribute =
>                     mCollection.attribute<EntityAnnotationsAttribute>(
> Akonadi::Collection::AddIfMissing ); Q_ASSERT(annotationsAttribute);
>             if (annotationsAttribute->value(s_timeStampKey) !=
> mHandler->latestTimestamp()) { annotationsAttribute->insert(s_timeStampKey,
> mHandler->latestTimestamp());
> mCollection.addAttribute(annotationsAttribute);
> 
>                 // no parent, this job will outlive the ListEntriesJob
>                 Akonadi::CollectionModifyJob *modJob = new
> Akonadi::CollectionModifyJob(mCollection); Q_UNUSED(modJob);
>             }
>             q->emitResult();
> 
> (where mCollection is an Akonadi::Collection member in a class that will be
> deleted before that job is done -- but surely that's fine, given that
> Collection is a refcounted value class??)
> 
> EntityAnnotationsAttribute (from kdepimlibs/akonadi) isn't actually used
> anywhere (strangely enough), but its code is 100% like
> kdepim-runtime/resources/shared/collectionannotationsattribute.cpp so the
> problem isn't there.
> 
> If nobody knows I guess I'll have to debug that refcounting code.... the
> crash is reproduceable.

-- 
Daniel Vrátil
www.dvratil.cz | dvratil at kde.org
IRC: dvratil on Freenode (#kde, #kontact, #akonadi, #fedora-kde)

GPG Key: 0x4D69557AECB13683
Fingerprint: 0ABD FA55 A4E6 BEA9 9A83 EA97 4D69 557A ECB1 3683
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20150412/fe308d82/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list