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
=== modified file 'src/window.cpp'
--- src/window.cpp 2011-04-08 11:40:39 +0000
+++ src/window.cpp 2011-04-12 12:28:26 +0000
@@ -5689,6 +5689,7 @@
5689 screen->screenNum ());5689 screen->screenNum ());
5690 Colormap cmap = DefaultColormap (screen->dpy (),5690 Colormap cmap = DefaultColormap (screen->dpy (),
5691 screen->screenNum ());5691 screen->screenNum ());
5692 bool success = false;
56925693
5693 if (frame || attrib.override_redirect)5694 if (frame || attrib.override_redirect)
5694 return false;5695 return false;
@@ -5700,17 +5701,22 @@
5700 * reparented themselves on the server side but not5701 * reparented themselves on the server side but not
5701 * on the client side */5702 * on the client side */
57025703
5703 XQueryTree (dpy, id, &root_return, &parent_return, &children, &nchildren);5704 success = XQueryTree (dpy, id, &root_return,
57045705 &parent_return, &children, &nchildren);
5705 if (parent_return != root_return)5706
5706 {5707 if (success && parent_return != root_return)
5707 XFree (children);5708 {
5708 XUngrabServer (dpy);5709 success = false;
5709 XSync (dpy, false);5710 XFree (children);
5710 return false;5711 }
5711 }5712
57125713 if (success && !XGetWindowAttributes (dpy, id, &wa))
5713 if (!XGetWindowAttributes (dpy, id, &wa))5714 {
5715 success = false;
5716 XFree (children);
5717 }
5718
5719 if (!success)
5714 {5720 {
5715 XUngrabServer (dpy);5721 XUngrabServer (dpy);
5716 XSync (dpy, false);5722 XSync (dpy, false);

Subscribers

People subscribed via source and target branches

to all changes: