Multiple QRegExp crashes when multithreading in KRunner

Thiago Macieira thiago at kde.org
Fri Jan 14 22:45:58 GMT 2011


On Friday, 14 de January de 2011 20:28:04 Andreas Pakulat wrote:
> On 14.01.11 17:51:56, Albert Astals Cid wrote:
> > A Divendres, 14 de gener de 2011, Sebastian Trueg va escriure:
> > > However, the query parser still uses static QRegExp objects which
> > > seems
> > > a bad idea, isn't that right?
> > > Thus, I suppose it would be better to wrap them in a mutex'ed object
> > > and create that via K_GLOBAL_STATIC?
> > 
> > Why would you want to wait on a mutex to use a QRegExp? Just create as
> > many QRegExp as you need and that's it.
> 
> The problem is that QRegExp creation is anything but cheap, thats the
> reason to keep pre-created QRegExp objects in the first place (at least
> that was the reason in KDevelop).

Right, but copying them is cheap.

So initialise them once, use them never. Always copy first, prior to use.
-- 
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/d112ceb1/attachment.sig>


More information about the kde-core-devel mailing list