[Kde-pim] FYI: Akonadi fails to compile on < Qt 5.3

Daniel Vrátil dvratil at redhat.com
Mon Dec 15 11:28:56 GMT 2014


On Sunday, December 14, 2014 12:42:36 PM Milian Wolff wrote:
> On Sunday 14 December 2014 12:29:25 Kevin Funk wrote:
> > Heya,
> > 
> > Just got this from a user in #kde-devel: https://paste.kde.org/pxvugaji8
> > 
> > Note sure what the intended minimum required Qt version is here, but
> > either
> > way this needs to be fixed in the root CMakeLists.txt then.
> > 
> > Caused by:
> > 
> > commit 8a113985cda1693c8158916065bd54e57d028cda
> > Author: Milian Wolff <mail at milianw.de>
> > Date:   Mon Dec 1 11:39:33 2014 +0100
> > 
> >     Use an QAtomicInt instead of a plain bool for Entity::cacheEnabled.
> >     
> >     A plain bool is not thread safe and leads to undefined behavior.
> >     So better be safe than sorry and use a thread safe QAtomicInt.
> > 
> > ^ Needs http://doc.qt.io/qt-5/qatomicinteger.html#operator-int (since 5.3)
> 
> Note: I worked on this patch in Qt 4 Akonadi. I was not aware that this
> breaks anything in Qt 5 master, which one could argue is due to a
> source-incompatible change then?

Sorry, I should have caught it during the review. I've run into this myself a 
couple times, but I always forget about what pain QAtomicInt is...

> Anyhow, would be easy to fix, just add a .load().

Not that simple: we support Qt 5 build on 1.13 branch too, so we need to fix 
it there in cross-Qt compatible way. Qt 4 QAtomicInt does not have .load() 
however, so this won't work. I guess we probably need to subclass QAtomicInt 
and implement the overload ourselves by either providing operator int() when 
Qt >= 5.0 && Qt < 5.3, or provide .load() when Qt <  5.0.

On master we can just use .load() and .store() everywhere.

Dan

> 
> Bye

-- 
Daniel Vrátil | dvratil at redhat.com | dvratil on #kde-devel, #kontact, #akonadi
Associate Software Engineer
KDE Desktop Team, Red Hat

GPG Key: 0xC59D614F6F4AE348                                                                                                                                                                                          
Fingerprint: 4EC1 86E3 C54E 0B39 5FDD B5FB C59D 614F 6F4A E348     
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20141215/e43d56f4/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