Multiple QRegExp crashes when multithreading in KRunner
Albert Astals Cid
aacid at kde.org
Fri Jan 14 17:51:56 GMT 2011
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.
Albert
>
> Cheers,
> Sebastian
>
> On 01/14/2011 01:17 AM, Thiago Macieira wrote:
> > On Thursday, 13 de January de 2011 23:33:14 Milian Wolff wrote:
> >> Matthias Fuchs, 13.01.2011:
> >>> Hi,
> >>>
> >>> There are some crashes related to QRegExp and multithreading, so they
> >>> appear when using KRunner.
> >>
> >> QRegExp is not threadsafe, you either have to guard it with a mutex or
> >> make sure it's not shared between threads.
> >
> > You're right.
> >
> > To be clear: as per Qt terminology, QRegExp is reentrant, not
> > thread-safe.
> >
> > That means you can use QRegExp in different threads, at the same time,
> > provided that they point to different objects. If it's the same object,
> > do as Milian said.
> >
> > It's easier to just create a copy in this case.
More information about the kde-core-devel
mailing list