QString -> QStringLiteral conversions might make applications crash on exit

Nick Shaforostoff shafff at ukr.net
Fri Feb 26 11:14:59 UTC 2016


> a) Everyone who makes QString -> QStringLiteral replacements should be
> extremely careful (which is very difficult, since it is not always
> obvious if passing a QString to a function will result in the string
> being stored in a global static object). Automated tools like clazy
> should then not recommend to use QStringLiteral any more.
> 
> b) Classes like KIconLoader, which are used as global static objects,
> should copy all strings that they get to the heap in order to prevent
> such crashes (which might also be quite difficult to do consistently).

from what i have seen, at least icons, fonts and regexps are the ones for which stringliterals should be avoided in libraries.
i have created a qt issue for mentioning this in qt documentation
https://bugreports.qt.io/browse/QTBUG-51418 

 
 


More information about the Kde-frameworks-devel mailing list