[Interest] invalidated copies of QString in QCommonStyle::cachedOption

Giuseppe D'Angelo dangelog at gmail.com
Tue Jan 19 10:37:22 CET 2016


On Mon, Jan 18, 2016 at 9:40 AM, Mojmír Svoboda <mojmir.svoboda at bistudio.com
> wrote:

> One of the copies is in QCommonStylePrivate::cachedOption::text field. I
> suspect these style classes use some form of sharing, so when i close the
> widget, the copy of qstring will survive the storage, and then when new
> qtableview opens, it tries to reuse the style and on the first use it
> destroys the old content of .text field and crash follows.
>

That is correct. It's an unfortunate side effect of QStrings built like
QStringLiteral does. We've seen that already when unloading plugins which
have handed out QStrings...


> Now what do i do? Try to force somehow the style class to drop the
> d->cachedOption?
> Any ideas, please?
>

Please trim down to a small testcase and submit a bug report. If your model
is well-behaving the view can't cache the option that way. You would have
crashes even if you use entirely public APIs (such as QString::fromRawData)
and that's unacceptable.

HTH,
-- 
Giuseppe D'Angelo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160119/f2ae4073/attachment.html>


More information about the Interest mailing list