Fix crash when accessing ShellClient::iconGeometry for a not mapped window

It uses windowManagementInterface which is null until the window
is mapped. A not mapped window obviously has an invalid iconGeometry.
icc-effect-5.14.5
Martin Gräßlin 2016-03-14 10:24:13 +01:00
parent 0b9e6a4aa2
commit bf932c4e97
2 changed files with 9 additions and 0 deletions

View File

@ -127,6 +127,10 @@ void StartTest::testCreateWindow()
// but still not yet in workspace
QVERIFY(workspace()->allClientList().isEmpty());
// icon geometry accesses windowManagementInterface which only exists after window became visible
// verify that accessing doesnt't crash
QVERIFY(waylandServer()->clients().first()->iconGeometry().isNull());
// let's render
QImage img(QSize(100, 50), QImage::Format_ARGB32);
img.fill(Qt::blue);

View File

@ -473,6 +473,11 @@ bool ShellClient::isMinimizable() const
QRect ShellClient::iconGeometry() const
{
if (!windowManagementInterface()) {
// window management interface is only available if the surface is mapped
return QRect();
}
int minDistance = INT_MAX;
ShellClient *candidatePanel = nullptr;
QRect candidateGeom;