Review Request 125220: KService: use a real global static for QThreadStorage rather than Q_GLOBAL_STATIC.

David Faure faure at kde.org
Sun Sep 13 22:09:51 UTC 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/125220/
-----------------------------------------------------------

Review request for KDE Frameworks and Thiago Macieira.


Repository: kservice


Description
-------

Creating QThreadStorage on demand leads to race conditions because the
id of the storagedata gets assigned once multiple threads are running,
and read from other threads without locking. I almost submitted a fix for
Qt when I realized the indirection I had here was unnecessary and wrong.

QThreadStorage must be created in the main thread, before any thread is running.


Diffs
-----

  src/services/kservicetypefactory.cpp 62fd230b4f7a6558c707d257796c5967f39c3607 
  src/services/kservicegroupfactory.cpp 08e0bdcd765ab08afdb71cabc640fd21a73f4218 
  src/services/kservicefactory.cpp 9b0e0c199818fea774c08a4f8fab5aca417927c8 
  src/services/kmimetypefactory.cpp ba07aa0bc9b5d528454cf426b1feadb049402123 

Diff: https://git.reviewboard.kde.org/r/125220/diff/


Testing
-------

helgrind ksycocathreadtest no longer complains about a race on QThreadStorageData::id


Thanks,

David Faure

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20150913/f9931eb2/attachment.html>


More information about the Kde-frameworks-devel mailing list