effect: Refuse starting quick effect if keyboard cannot be grabbed

If effects->grabKeyboard() fails and effects->ungrabKeyboard() is called
later, kwin will crash due to an assert in the ungrabKeyboard() function.

This matters only on X11.
This commit is contained in:
Vlad Zahorodnii 2024-08-21 21:24:18 +03:00
parent d474a6795b
commit 95611189d5

View file

@ -500,6 +500,12 @@ void QuickSceneEffect::startInternal()
return;
}
if (!effects->grabKeyboard(this)) {
return;
}
effects->startMouseInterception(this, Qt::ArrowCursor);
effects->setActiveFullScreenEffect(this);
d->running = true;
@ -516,9 +522,6 @@ void QuickSceneEffect::startInternal()
connect(effects, &EffectsHandler::screenAdded, this, &QuickSceneEffect::handleScreenAdded);
connect(effects, &EffectsHandler::screenRemoved, this, &QuickSceneEffect::handleScreenRemoved);
effects->grabKeyboard(this);
effects->startMouseInterception(this, Qt::ArrowCursor);
}
void QuickSceneEffect::stopInternal()