Multiple QRegExp crashes when multithreading in KRunner

Thiago Macieira thiago at kde.org
Fri Jan 14 00:16:07 GMT 2011


On Thursday, 13 de January de 2011 15:08:06 Aaron J. Seigo wrote:
> On Thursday, January 13, 2011, Thiago Macieira wrote:
> > On Thursday, 13 de January de 2011 22:43:28 Matthias Fuchs wrote:
> > > Hi,
> > > 
> > > There are some crashes related to QRegExp and multithreading, so
> > > they
> > > appear when using KRunner.
> > 
> > There should be no crashes related to QRegExp and threading since Qt
> > 4.4.
> > If you find something, it's usually because you used the same QRegExp
> > object to conduct searches at the same time.
> 
> yes, that's exactly what's happening :) Matthias already fixed one krunner
> plugin that was doing this, but not he's faced with the
> Nepomuk::Query::QueryParser bits.
> 
> as it is internal to Nepomuk and it is using static members internal to the
> library (meaning krunner or any other app can't just use a "different
> Nepomuk object") QThreadStorage seems the easiest solution here.

Nah.

Just create a copy on the stack:

QRegExp rx = theRx;
if (rx.indexIn(str) != 0) { ... }

-- 
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/f925debe/attachment.sig>


More information about the kde-core-devel mailing list