D9016: remove global statics

Francis Herne noreply at phabricator.kde.org
Tue Nov 28 22:36:30 UTC 2017

flherne requested changes to this revision.
flherne added inline comments.
This revision now requires changes to proceed.


> helpers.cpp:370
> +    if ( correctionFileDirs.isEmpty() ) {
> +        QMutexLocker lock(&cacheMutex());
> +        correctionFileDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,

I don't believe this is truly safe. It prevents multiple threads writing simultaneously, but other threads may read while the write takes place, which isn't permitted.

Either the mutex should cover the whole thing, or it might be more performant to use a QReadWriteLock?

Of course, since there was no locking at all before and nothing blew up, this is probably a statistical irrelevance...

> helpers.cpp:397
> +    if ( localCorrectionFileDir.isEmpty() ) {
> +        QMutexLocker lock(&cacheMutex());
> +        localCorrectionFileDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)

As above.


To: brauch, flherne
Cc: anthonyfieroni, kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20171128/4f0c9dc7/attachment.html>

More information about the KDevelop-devel mailing list