Multiple QRegExp crashes when multithreading in KRunner

Matthias Fuchs mat69 at gmx.net
Sat Jan 15 22:27:50 GMT 2011


Am Samstag 15 Januar 2011, 15:08:28 schrieb Thiago Macieira:
> On Saturday, 15 de January de 2011 12:28:38 Ingo Klöcker wrote:
> > On Friday 14 January 2011, Thiago Macieira wrote:
> > > On Friday, 14 de January de 2011 21:49:01 Ingo Klöcker wrote:
> > > > On Friday 14 January 2011, Thiago Macieira wrote:
> > > > > 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.
> > > > 
> > > > Why?
> > > 
> > > Because it's static. Static non-PODs aren't a good idea.
> > 
> > Where static means file static, right?
> 
> File-static, class-static or function-static, though function-static is the
> least evil of those.

I am not sure if you missed my previous mail, though the following code also 
lead to a crash in Qt 4.6.3:

QStringList KGetRunner::parseUrls(const QString &text) const
{
  ...
  QRegExp re("\\b\\S+");
  int i = re.indexIn(text);
  ...
}

I wonder what could have caused this -- as I did not experience this myself.

http://websvn.kde.org/tags/KDE/4.4.5/kdenetwork/kget/plasma/runner/kgetrunner.cpp?revision=1142811&view=markup
Crash happens at line 114, also see 
https://bugs.kde.org/show_bug.cgi?id=255860

Is there anything I could do about this, or might it be that this problem does 
not occur with later Qt versions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20110115/2d88e07c/attachment.htm>


More information about the kde-core-devel mailing list