[Development] RFD: plugins vs QStringLiterals
Kevin Kofler
kevin.kofler at chello.at
Fri Nov 6 17:20:51 CET 2015
Thiago Macieira wrote:
> 1) Declare it SEP and only apply workarounds for the places where
> QStringLiteral is used in our plugins, suggesting that people do the same
> in their plugins.
>
> Problems: libraries loaded by plugins, fragile.
+1. Caveat emptor.
Deep copying destroys the point of QStringLiteral, never unloading plugins
is a crude hack.
There is only really a problem if the strings (or shallow copies thereof)
are passed around in the program after unloading the plugin. So this is very
much in the control of the plugin author. They just need to deep-copy the
strings they return in the plugin interface with:
QString(orig.constData(), orig.size())
if they can be QStringLiterals and are susceptible of outliving the plugin.
Kevin Kofler
More information about the Development
mailing list