diff options
| author | Daniel d'Andrada <daniel.dandrada@canonical.com> | 2012-03-02 05:13:45 -0500 |
|---|---|---|
| committer | Tarmac <> | 2012-03-02 05:13:45 -0500 |
| commit | 40f3d95263bc6c65b3d1722edbe62f745c78e5a3 (patch) | |
| tree | 161758b406cf1b305f18304576fd43f6970cf987 | |
| parent | 78bb45be556f0346dec5c2bd5d704d56c851042b (diff) | |
| parent | 773c53fdabb7d95fc9ab7ca0ee4a933b17d17426 (diff) | |
Fixes lp:942625
GestureEngine::FindCompWindow() would enter in an infinite loop if the window passed to it is the root window since its break condition (parent == root) would never be reached as parent would be zero. Also includes some other safeguards around the same issue. UNBLOCK. Fixes: https://bugs.launchpad.net/bugs/942625. Approved by Marco Trevisan (TreviƱo). (bzr r2047)
| -rw-r--r-- | plugins/unityshell/src/GestureEngine.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/unityshell/src/GestureEngine.cpp b/plugins/unityshell/src/GestureEngine.cpp index 96110111f..5a72843cb 100644 --- a/plugins/unityshell/src/GestureEngine.cpp +++ b/plugins/unityshell/src/GestureEngine.cpp @@ -85,13 +85,18 @@ GestureEngine::FindCompWindow(Window window) Window parent, root; Window* children = NULL; unsigned int nchildren; + Status status; - XQueryTree(_screen->dpy(), window, &root, &parent, &children, &nchildren); + status = XQueryTree(_screen->dpy(), window, &root, &parent, &children, &nchildren); + if (status == 0) + break; if (children) XFree(children); - if (parent == root) + // parent will be zero when the window passed to this method is already the + // root one. + if (parent == root || parent == 0) break; window = parent; @@ -215,7 +220,7 @@ GestureEngine::OnRotateFinish(GeisAdapter::GeisRotateData* data) void GestureEngine::OnTouchStart(GeisAdapter::GeisTouchData* data) { - if (data->touches == 3) + if (data->touches == 3 && data->window != 0) { CompWindow* result = FindCompWindow(data->window); |
