Merge lp:~unity-team/compiz/trunk.fix_758307 into lp:~unity-team/compiz/trunk

Proposed by Sam Spilsbury
Status: Merged
Merge reported by: David Barth
Merged at revision: not available
Proposed branch: lp:~unity-team/compiz/trunk.fix_758307
Merge into: lp:~unity-team/compiz/trunk
Diff against target: 45 lines (+17/-11)
1 file modified
src/window.cpp (+17/-11)
To merge this branch: bzr merge lp:~unity-team/compiz/trunk.fix_758307
Reviewer Review Type Date Requested Status
David Barth (community) Approve
Review via email: mp+57313@code.launchpad.net

Description of the change

Check the return value of XQueryTree which determines if the parent window == the root window to ensure that it actually succeeded, since if it didn't then children is going to be an invalid pointer and freeing those is always bad. Fixes LP #758307

To post a comment you must log in.
Revision history for this message
David Barth (dbarth) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/window.cpp'
2--- src/window.cpp 2011-04-08 11:40:39 +0000
3+++ src/window.cpp 2011-04-12 12:28:26 +0000
4@@ -5689,6 +5689,7 @@
5 screen->screenNum ());
6 Colormap cmap = DefaultColormap (screen->dpy (),
7 screen->screenNum ());
8+ bool success = false;
9
10 if (frame || attrib.override_redirect)
11 return false;
12@@ -5700,17 +5701,22 @@
13 * reparented themselves on the server side but not
14 * on the client side */
15
16- XQueryTree (dpy, id, &root_return, &parent_return, &children, &nchildren);
17-
18- if (parent_return != root_return)
19- {
20- XFree (children);
21- XUngrabServer (dpy);
22- XSync (dpy, false);
23- return false;
24- }
25-
26- if (!XGetWindowAttributes (dpy, id, &wa))
27+ success = XQueryTree (dpy, id, &root_return,
28+ &parent_return, &children, &nchildren);
29+
30+ if (success && parent_return != root_return)
31+ {
32+ success = false;
33+ XFree (children);
34+ }
35+
36+ if (success && !XGetWindowAttributes (dpy, id, &wa))
37+ {
38+ success = false;
39+ XFree (children);
40+ }
41+
42+ if (!success)
43 {
44 XUngrabServer (dpy);
45 XSync (dpy, false);

Subscribers

People subscribed via source and target branches

to all changes: