diff options
| author | Daniel d'Andrada <daniel.dandrada@canonical.com> | 2012-03-01 17:49:58 -0300 |
|---|---|---|
| committer | Daniel d'Andrada <daniel.dandrada@canonical.com> | 2012-03-01 17:49:58 -0300 |
| commit | 773c53fdabb7d95fc9ab7ca0ee4a933b17d17426 (patch) | |
| tree | 028e73ae803fc236da9cee1a35d0d927ad17768d | |
| parent | a2a989c8ad39f266933aee1efba65f37362a5b8b (diff) | |
Fixes infinite loop in GestureEngine. 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. Fixes LP: #942625 (bzr r2044.2.1)
| -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); |
