[input] Add safety checks before accessing Cursor of focused pointer
There might be no focused pointer and there might be no cursor.
This commit is contained in:
parent
92d06a8c4b
commit
e8b14cd587
1 changed files with 10 additions and 2 deletions
12
input.cpp
12
input.cpp
|
@ -341,7 +341,11 @@ void InputRedirection::updatePointerWindow()
|
||||||
if (oldWindow) {
|
if (oldWindow) {
|
||||||
disconnect(oldWindow.data(), &Toplevel::geometryChanged, this, &InputRedirection::updateFocusedPointerPosition);
|
disconnect(oldWindow.data(), &Toplevel::geometryChanged, this, &InputRedirection::updateFocusedPointerPosition);
|
||||||
if (AbstractBackend *b = waylandServer()->backend()) {
|
if (AbstractBackend *b = waylandServer()->backend()) {
|
||||||
disconnect(seat->focusedPointer()->cursor(), &KWayland::Server::Cursor::changed, b, &AbstractBackend::installCursorFromServer);
|
if (auto p = seat->focusedPointer()) {
|
||||||
|
if (auto c = p->cursor()) {
|
||||||
|
disconnect(c, &KWayland::Server::Cursor::changed, b, &AbstractBackend::installCursorFromServer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (t && t->surface()) {
|
if (t && t->surface()) {
|
||||||
|
@ -349,7 +353,11 @@ void InputRedirection::updatePointerWindow()
|
||||||
connect(t, &Toplevel::geometryChanged, this, &InputRedirection::updateFocusedPointerPosition);
|
connect(t, &Toplevel::geometryChanged, this, &InputRedirection::updateFocusedPointerPosition);
|
||||||
if (AbstractBackend *b = waylandServer()->backend()) {
|
if (AbstractBackend *b = waylandServer()->backend()) {
|
||||||
b->installCursorFromServer();
|
b->installCursorFromServer();
|
||||||
connect(seat->focusedPointer()->cursor(), &KWayland::Server::Cursor::changed, b, &AbstractBackend::installCursorFromServer);
|
if (auto p = seat->focusedPointer()) {
|
||||||
|
if (auto c = p->cursor()) {
|
||||||
|
connect(c, &KWayland::Server::Cursor::changed, b, &AbstractBackend::installCursorFromServer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
seat->setFocusedPointerSurface(nullptr);
|
seat->setFocusedPointerSurface(nullptr);
|
||||||
|
|
Loading…
Reference in a new issue