diff options
author | Jan Kundrát <jkt@kde.org> | 2015-03-11 16:42:10 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2015-03-12 07:25:15 +0000 |
commit | 4c022338aa787c216c3afa217987e4125bd15b41 (patch) | |
tree | 1cda2bdeba671117a8a791c8f387b466e2a57c00 /src/plugins/platforms/xcb/qxcbconnection.cpp | |
parent | 58b4cf8722e80248885e38996d4688f471b73e4f (diff) |
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>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 81d8a9b72a..d106473daa 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1300,7 +1300,8 @@ xcb_timestamp_t QXcbConnection::getTimestamp() xcb_window_t QXcbConnection::rootWindow() { - return primaryScreen()->root(); + QXcbScreen *s = primaryScreen(); + return s ? s->root() : 0; } #ifdef XCB_USE_XLIB |