Multiple QRegExp crashes when multithreading in KRunner

Thiago Macieira thiago at kde.org
Fri Jan 14 17:48:41 GMT 2011


On Friday, 14 de January de 2011 13:46:19 Sebastian Trueg wrote:
> However, the query parser still uses static QRegExp objects which seems
> a bad idea, isn't that right?

static QRegExp are a bad idea regardless of whether threading is involved or 
not.

> Thus, I suppose it would be better to wrap them in a mutex'ed object and
> create that via K_GLOBAL_STATIC?

It's your choice. If you use global objects without mutex protection, you must 
mark your functions as thread-unsafe and not reentrant. Then whoever is using 
them must be sure to avoid concurrency.

You don't need K_GLOBAL_STATIC for mutex protection, but it would be nice.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20110114/a195228a/attachment.sig>


More information about the kde-core-devel mailing list