Minimal platform: fix leaking QMinimalScreen instance

This caused false alarms in fuzzing tests.

The lifetime of the screen is the same as that of QMinimalIntegration.
But failure to call handleScreenRemoved() also causes a warning; so
as on "normal" platforms, the screen has to be separately allocated.

Change-Id: Iad0cc53b8d09687400ced28bc2353b7500b01110
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
bb10
Shawn Rutledge 2020-04-06 12:11:36 +02:00
parent 14c55e2979
commit 9901d39ea6
2 changed files with 7 additions and 5 deletions

View File

@ -103,17 +103,18 @@ QMinimalIntegration::QMinimalIntegration(const QStringList &parameters)
m_options |= DebugBackingStore | EnableFonts;
}
QMinimalScreen *mPrimaryScreen = new QMinimalScreen();
m_primaryScreen = new QMinimalScreen();
mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320);
mPrimaryScreen->mDepth = 32;
mPrimaryScreen->mFormat = QImage::Format_ARGB32_Premultiplied;
m_primaryScreen->mGeometry = QRect(0, 0, 240, 320);
m_primaryScreen->mDepth = 32;
m_primaryScreen->mFormat = QImage::Format_ARGB32_Premultiplied;
QWindowSystemInterface::handleScreenAdded(mPrimaryScreen);
QWindowSystemInterface::handleScreenAdded(m_primaryScreen);
}
QMinimalIntegration::~QMinimalIntegration()
{
QWindowSystemInterface::handleScreenRemoved(m_primaryScreen);
delete m_fontDatabase;
}

View File

@ -88,6 +88,7 @@ public:
private:
mutable QPlatformFontDatabase *m_fontDatabase;
QMinimalScreen *m_primaryScreen;
unsigned m_options;
};