Plug memleaks in tst_QWidget
We need to delete the style returned from QStyleFactory::create() ourselves, so put them into a QScopedPointer. The alternative would have been to create this once, as a member of tst_QWidget, but this is the minimal approach that ensures behavior just as the old code, but without the leak. Change-Id: I527f1031c57be6f05942f4acc057e7dae1af2571 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
24314c73ae
commit
da2c73ad2b
@ -5135,7 +5135,8 @@ void tst_QWidget::moveChild()
|
|||||||
|
|
||||||
ColorWidget parent(0, Qt::Window | Qt::WindowStaysOnTopHint);
|
ColorWidget parent(0, Qt::Window | Qt::WindowStaysOnTopHint);
|
||||||
// prevent custom styles
|
// prevent custom styles
|
||||||
parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
|
const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
|
||||||
|
parent.setStyle(style.data());
|
||||||
ColorWidget child(&parent, Qt::Widget, Qt::blue);
|
ColorWidget child(&parent, Qt::Widget, Qt::blue);
|
||||||
|
|
||||||
#ifndef Q_OS_WINCE
|
#ifndef Q_OS_WINCE
|
||||||
@ -5184,7 +5185,8 @@ void tst_QWidget::showAndMoveChild()
|
|||||||
QSKIP("Wayland: This fails. Figure out why.");
|
QSKIP("Wayland: This fails. Figure out why.");
|
||||||
QWidget parent(0, Qt::Window | Qt::WindowStaysOnTopHint);
|
QWidget parent(0, Qt::Window | Qt::WindowStaysOnTopHint);
|
||||||
// prevent custom styles
|
// prevent custom styles
|
||||||
parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
|
const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
|
||||||
|
parent.setStyle(style.data());
|
||||||
|
|
||||||
QDesktopWidget desktop;
|
QDesktopWidget desktop;
|
||||||
QRect desktopDimensions = desktop.availableGeometry(&parent);
|
QRect desktopDimensions = desktop.availableGeometry(&parent);
|
||||||
@ -6680,7 +6682,9 @@ void tst_QWidget::renderWithPainter()
|
|||||||
{
|
{
|
||||||
QWidget widget(0, Qt::Tool);
|
QWidget widget(0, Qt::Tool);
|
||||||
// prevent custom styles
|
// prevent custom styles
|
||||||
widget.setStyle(QStyleFactory::create(QLatin1String("Windows")));
|
|
||||||
|
const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
|
||||||
|
widget.setStyle(style.data());
|
||||||
widget.show();
|
widget.show();
|
||||||
widget.resize(70, 50);
|
widget.resize(70, 50);
|
||||||
widget.setAutoFillBackground(true);
|
widget.setAutoFillBackground(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user