screencast: Handle the case where pipewire is not installed

If pipewire is not installed, pw_loop_new() may return a nullptr.

BUG: 427949
This commit is contained in:
Vlad Zahorodnii 2020-10-26 11:31:17 +02:00
parent 9b09f0399f
commit 4b12afced9

View file

@ -56,6 +56,11 @@ void PipeWireCore::onCoreError(void* data, uint32_t id, int seq, int res, const
bool PipeWireCore::init()
{
pwMainLoop = pw_loop_new(nullptr);
if (!pwMainLoop) {
qCWarning(KWIN_SCREENCAST, "Failed to create PipeWire loop: %s", strerror(errno));
m_error = i18n("Failed to start main PipeWire loop");
return false;
}
pw_loop_enter(pwMainLoop);
QSocketNotifier *notifier = new QSocketNotifier(pw_loop_get_fd(pwMainLoop), QSocketNotifier::Read, this);