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.
master
Martin Gräßlin 9 years ago
parent 0b9e6a4aa2
commit bf932c4e97

@ -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);

@ -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;

Loading…
Cancel
Save