Fix a warning about null sender in QObject::connect()

The original assumption was that once PointerInputRedirection starts
pushing cursor sources to cursors, they cannot be null. In many cases,
it is true, but the tests are a bit special as many of them lack
wl_pointer.set_cursor requests, so it's possible to set a null source.
As an example, when the pointer moves from the decoration to the
surface. On the other hand, it also does make sense to allow having
no source connected.
This commit is contained in:
Vlad Zahorodnii 2024-02-13 13:36:52 +02:00
parent f6447ad188
commit 55ef69645c

View file

@ -709,7 +709,9 @@ void Cursor::setSource(CursorSource *source)
disconnect(m_source, &CursorSource::changed, this, &Cursor::cursorChanged);
}
m_source = source;
connect(m_source, &CursorSource::changed, this, &Cursor::cursorChanged);
if (m_source) {
connect(m_source, &CursorSource::changed, this, &Cursor::cursorChanged);
}
Q_EMIT cursorChanged();
}