From f0aeda07383533a7908dd287c02e3a4a1f9cb532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 13 Jul 2016 10:08:25 +0200 Subject: [PATCH] [platforms/fbdev] Handle error conditions more gracefully Summary: So far if the framebuffer platform run into an error on initialization it did not continue and caused the system to freeze. With this change it properly emits the initFailed signal in all error conditions which causes kwin_wayland to terminate. This is a much better situation than just staying in a running, but frozen state. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D2149 --- plugins/platforms/fbdev/fb_backend.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/platforms/fbdev/fb_backend.cpp b/plugins/platforms/fbdev/fb_backend.cpp index 370ad43da1..7955b36030 100644 --- a/plugins/platforms/fbdev/fb_backend.cpp +++ b/plugins/platforms/fbdev/fb_backend.cpp @@ -88,11 +88,20 @@ void FramebufferBackend::openFrameBuffer() fd = open(deviceIdentifier().constData(), O_RDWR | O_CLOEXEC); if (fd < 0) { qCWarning(KWIN_FB) << "failed to open frame buffer device"; + emit initFailed(); return; } m_fd = fd; - queryScreenInfo(); + if (!queryScreenInfo()) { + qCWarning(KWIN_FB) << "failed to query framebuffer information"; + emit initFailed(); + return; + } initImageFormat(); + if (m_imageFormat == QImage::Format_Invalid) { + emit initFailed(); + return; + } setReady(true); emit screensQueried(); }