QString -> QStringLiteral conversions might make applications crash on exit

Jan Kundrát jkt at kde.org
Fri Feb 26 12:25:18 UTC 2016


On Friday, 26 February 2016 01:37:57 CET, Frank Reininghaus wrote:
> This becomes a problem if the read-only data that the QString refers
> to are not there any more, which can happen if the QString was stored
> in a global static object from one library, and the QStringLiteral is
> from another library, which might have been unloaded before the global
> static object was destroyed.

Are you 100% sure that this is not "just" due to icon loaders which are 
implemented as plugins [1]?

Upstream says [2] that they do not want to support unloading of plugins 
which "leak" Qt data. There's a patch [3] which implements this for all 
plugins (including the icon loaders). Apparently, it's been so ever since 
Qt 5.0.

For an example on how an application can workaround this thing, see my 
patch to Trojitá [4].

Cheers,
Jan

[1] https://bugreports.qt.io/browse/QTBUG-50829
[2] 
https://bugreports.qt.io/browse/QTBUG-49061?focusedCommentId=297937&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-297937
[3] https://codereview.qt-project.org/140750
[4] 
https://gerrit.vesnicky.cesnet.cz/r/#/c/595/5/src/UiUtils/IconLoader.cpp

-- 
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/


More information about the Kde-frameworks-devel mailing list