You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
plasma-workspace/0013-Fix-for-xembedsniproxy...

51 lines
1.8 KiB

From 1c098f6efa9ce449bc94e71bf8e317e1d607c4f8 Mon Sep 17 00:00:00 2001
From: Maciej Sitarz <macieksitarz@wp.pl>
Date: Mon, 8 Jan 2018 15:01:11 +0000
Subject: [PATCH 13/13] Fix for xembedsniproxy crash due to NULL returned from
xcb_image_get()
Summary:
In my environment (Fedora 27, plasma-workspace-5.11.4-1.fc27.x86_64) xembedsniproxy crashes.
This is caused by NULL being returned by xcb_image_get().
This should fix or at least mitigate the problems from bugs:
https://bugs.kde.org/show_bug.cgi?id=355463
https://bugs.kde.org/show_bug.cgi?id=359664
https://bugzilla.redhat.com/show_bug.cgi?id=1497829
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: broulik, plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9732
---
xembed-sni-proxy/sniproxy.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/xembed-sni-proxy/sniproxy.cpp b/xembed-sni-proxy/sniproxy.cpp
index 7fb00dbb..932109d9 100644
--- a/xembed-sni-proxy/sniproxy.cpp
+++ b/xembed-sni-proxy/sniproxy.cpp
@@ -288,7 +288,13 @@ QImage SNIProxy::getImageNonComposite() const
xcb_image_t *image = xcb_image_get(c, m_windowId, 0, 0, geom->width, geom->height, 0xFFFFFFFF, XCB_IMAGE_FORMAT_Z_PIXMAP);
// Don't hook up cleanup yet, we may use a different QImage after all
- QImage naiveConversion = QImage(image->data, image->width, image->height, QImage::Format_ARGB32);
+ QImage naiveConversion;
+ if (image) {
+ naiveConversion = QImage(image->data, image->width, image->height, QImage::Format_ARGB32);
+ } else {
+ qCDebug(SNIPROXY) << "Skip NULL image returned from xcb_image_get() for" << m_windowId << Title();
+ return QImage();
+ }
if (isTransparentImage(naiveConversion)) {
QImage elaborateConversion = QImage(convertFromNative(image));
--
2.14.3