[Interest] can the QRegExpEngine cache acces objects belonging to an unloaded library during global destruction?

Martins, Sérgio sergio.martins at kdab.com
Mon Jan 29 19:39:57 CET 2018


On 2018-01-29 18:24, René J.V. Bertin wrote:
> Hi,
> 
>> Don't use QStringLiteral with QRegExp, specially in plugins you'll
>> unload.
>> See https://blogs.kde.org/2015/11/05/qregexp-qstringliteral-crash-exit
> 
> The backtrace there certainly looks familiar. The mentioned fix (in
> 5.6) was to stop unloading plugins, a principle that's clearly not
> being applied here.

The Qt bugs were fixed in 5.6, not the user bugs.
Note that one can reproduce the problems by using const char *, without 
even using Qt. It's out of our hands to fix.

> What bothers me here is that the explanation suggests that it doesn't
> matter if you do `QRegExp(QStringLiteral("foo"))` or if there are 27
> intermediate variables and function arguments between the QRegExp and
> the QStringLiteral. I hope that's me misunderstanding because
> otherwise we almost have to drop the NO_CAST_FROM_ASCII build option;
> KIO use a *lot* of QRegExp instances I noticed, and the code is
> evidently littered with QStringLiterals.

No need drop it, just use QLatin1String wherever plugins and QRegExp is 
involved, or check if not unloading kde plugins could be an option.



Regards,
-- 
Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt, C++ and OpenGL Experts



More information about the Interest mailing list