Marc Mutz d884591391 tst_QComboBox: fix memleak in task_QTBUG_56693_itemFontFromModel()
QProxyStyle's ctor arguments are not QObject parents, but the proxied
style, which becomes the proxy's QObject ... get this ... _child_.

What a broken concept... It means that this test function took
ownership of QApplication::style(), and the only way it wasn't going
to wreak havoc on the rest of the test functions was to leak it after
use.

To fix, create the style on the stack, so it gets automatically freed
by the compiler on all exists from the function. As a drive-by, use {}
instead of () to call the ctor (not to prevent C++' Most Vexing Parse,
just because it's easier on the eye).

The meat of the change, however, is in making the helper proxy-style
defend against QProxyStyle's grabbing of the baseStyle() as its child,
and managing baseStyle()->d->proxyStyle so we properly dissociate from
qApp->style() after we're done. Needed to use ctor delegation to
extract original parent and proxy model from the incoming style before
QProxyStyle, our first subobject, gets first picking on the style,
destroying the very state we're trying to preserve.

This should be become some QTest::LocalProxyStyle, if we find more
users of this pattern.

Amends 5cff7d2b679d48a247b4630cb9e3d5b04fab0b55.

Pick-to: 6.9 6.8 6.5 5.15
Change-Id: I2abf4a0bf54158254fd8d526de55ad486ca4e296
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-04-02 16:37:47 +02:00
2025-03-24 19:01:57 +02:00
2024-11-05 14:36:16 +01:00
2024-11-05 14:36:16 +01:00
2024-12-13 14:54:23 +00:00
2025-03-24 23:19:04 +01:00
2024-06-25 11:44:00 +02:00
Description
Qt Base (Core, Gui, Widgets, Network, ...)
822 MiB
Languages
C++ 84.3%
HTML 4.9%
C 3.9%
CMake 3.6%
Objective-C++ 2%
Other 0.8%