Multiple QRegExp crashes when multithreading in KRunner

Sebastian Trueg trueg at kde.org
Fri Jan 14 12:46:19 GMT 2011


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?

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