qt5-qtbase/qt5-qtbase-5.5-0006-fix-segfault-when-requesting-root-window-and-there-are-no-screens.patch

44 lines
2.4 KiB
Diff

commit 4c022338aa787c216c3afa217987e4125bd15b41
Author: Jan Kundrát <jkt@kde.org>
Date: Wed Mar 11 16:42:10 2015 +0100
Fix segfault when requesting root window and there are no screens
This was easy to hit with KDE Plasma 5.2.1; KWindowSystem called
QX11Info::appRootWindow() which in turn tried to dereference a nullptr
returned from QXcbConnection::primaryScreen().
#0 QXcbConnection::rootWindow (this=<optimized out>)
at qtgui-5.5.9999/src/plugins/platforms/xcb/qxcbconnection.cpp:1303
#1 0x00007fc26da096d7 in QXcbNativeInterface::rootWindow (this=this@entry=0x7fc27d1734d0)
at qtgui-5.5.9999/work/qtgui-5.5.9999/src/plugins/platforms/xcb/qxcbnativeinterface.cpp:425
#2 0x00007fc26da0ab21 in QXcbNativeInterface::nativeResourceForIntegration (this=0x7fc27d1734d0, resourceString=...)
at qtgui-5.5.9999/work/qtgui-5.5.9999/src/plugins/platforms/xcb/qxcbnativeinterface.cpp:223
#3 0x00007fc27c563148 in QX11Info::appRootWindow (screen=screen@entry=-1)
at qtx11extras-5.5.9999/work/qtx11extras-5.5.9999/src/x11extras/qx11info_x11.cpp:158
#4 0x00007fc27a98c444 in NETEventFilter::nativeEventFilter (this=0x7fc27d425b60, ev=0x7fc264004ad0)
at kwindowsystem-5.7.0/work/kwindowsystem-5.7.0/src/kwindowsystem_x11.cpp:192
#5 0x00007fc2795d0a8a in QAbstractEventDispatcher::filterNativeEvent (this=<optimized out>,
eventType=..., message=message@entry=0x7fc264004ad0, result=result@entry=0x7ffc96ecf348)
at qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qabstracteventdispatcher.cpp:460
#6 0x00007fc26d9ea941 in QXcbConnection::handleXcbEvent (this=this@entry=0x7fc27d173580, event=event@entry=0x7fc264004ad0)
at qtgui-5.5.9999/src/plugins/platforms/xcb/qxcbconnection.cpp:971
Change-Id: I98a5d767cd7e143f00666f6fc78e9dc10893513d
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 0db7603..523ae79 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -1367,7 +1367,8 @@ xcb_timestamp_t QXcbConnection::getTimestamp()
xcb_window_t QXcbConnection::rootWindow()
{
- return primaryScreen()->root();
+ QXcbScreen *s = primaryScreen();
+ return s ? s->root() : 0;
}
void QXcbConnection::processXcbEvents()