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.
This commit is contained in:
parent
0b9e6a4aa2
commit
bf932c4e97
2 changed files with 9 additions and 0 deletions
|
@ -127,6 +127,10 @@ void StartTest::testCreateWindow()
|
||||||
// but still not yet in workspace
|
// but still not yet in workspace
|
||||||
QVERIFY(workspace()->allClientList().isEmpty());
|
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
|
// let's render
|
||||||
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
QImage img(QSize(100, 50), QImage::Format_ARGB32);
|
||||||
img.fill(Qt::blue);
|
img.fill(Qt::blue);
|
||||||
|
|
|
@ -473,6 +473,11 @@ bool ShellClient::isMinimizable() const
|
||||||
|
|
||||||
QRect ShellClient::iconGeometry() const
|
QRect ShellClient::iconGeometry() const
|
||||||
{
|
{
|
||||||
|
if (!windowManagementInterface()) {
|
||||||
|
// window management interface is only available if the surface is mapped
|
||||||
|
return QRect();
|
||||||
|
}
|
||||||
|
|
||||||
int minDistance = INT_MAX;
|
int minDistance = INT_MAX;
|
||||||
ShellClient *candidatePanel = nullptr;
|
ShellClient *candidatePanel = nullptr;
|
||||||
QRect candidateGeom;
|
QRect candidateGeom;
|
||||||
|
|
Loading…
Reference in a new issue