Handle parent is None from query_tree_reply in QxcbWindow::frameMargins

None is a valid return value for parent in xcb_query_tree_reply_t.
If that is used as the new parent the next call to
xcb_query_tree_unchecked will fail with a BadWindow error.

Change-Id: Iafe29b223ca65c86ecfd40fe51e67d4bd7abc1ce
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Martin Gräßlin 2014-04-08 10:18:18 +02:00 committed by The Qt Project
parent ba5e0d48b4
commit 53a5dd28c7

View File

@ -554,7 +554,7 @@ QMargins QXcbWindow::frameMargins() const
xcb_query_tree_reply_t *reply = xcb_query_tree_reply(xcb_connection(), cookie, NULL); xcb_query_tree_reply_t *reply = xcb_query_tree_reply(xcb_connection(), cookie, NULL);
if (reply) { if (reply) {
if (reply->root == reply->parent || virtualRoots.indexOf(reply->parent) != -1) { if (reply->root == reply->parent || virtualRoots.indexOf(reply->parent) != -1 || reply->parent == XCB_WINDOW_NONE) {
foundRoot = true; foundRoot = true;
} else { } else {
window = parent; window = parent;