mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
Improve handling of errors when calling CompositeNameWindowPixmap
To guard against CompositeNameWindowPixmap failing, just use an error trap. Previous code used: GrabServer/GetWindowAttributes/CompositeNameWindowPixmap/UngrabServer To prevent BadMatch errors from !viewable, but didn't check the return value of GetWindowAttributes and didn't check if an error occured during the error trap. This way is more correct and more efficient. http://bugzilla.gnome.org/show_bug.cgi?id=580023
This commit is contained in:
parent
626912a9a4
commit
63b1d6642c
@ -1474,24 +1474,23 @@ repair_win (MutterWindow *cw)
|
||||
if (priv->back_pixmap == None)
|
||||
{
|
||||
gint pxm_width, pxm_height;
|
||||
XWindowAttributes attr;
|
||||
|
||||
meta_error_trap_push (display);
|
||||
|
||||
XGrabServer (xdisplay);
|
||||
|
||||
XGetWindowAttributes (xdisplay, xwindow, &attr);
|
||||
|
||||
if (attr.map_state == IsViewable)
|
||||
priv->back_pixmap = XCompositeNameWindowPixmap (xdisplay, xwindow);
|
||||
else
|
||||
|
||||
if (meta_error_trap_pop_with_return (display, FALSE) != Success)
|
||||
{
|
||||
/* Probably a BadMatch if the window isn't viewable; we could
|
||||
* GrabServer/GetWindowAttributes/NameWindowPixmap/UngrabServer/Sync
|
||||
* to avoid this, but there's no reason to take two round trips
|
||||
* when one will do. (We need that Sync if we want to handle failures
|
||||
* for any reason other than !viewable. That's unlikely, but maybe
|
||||
* we'll BadAlloc or something.)
|
||||
*/
|
||||
priv->back_pixmap = None;
|
||||
}
|
||||
|
||||
XUngrabServer (xdisplay);
|
||||
meta_error_trap_pop (display, FALSE);
|
||||
|
||||
if (priv->back_pixmap == None)
|
||||
{
|
||||
meta_verbose ("Unable to get named pixmap for %p\n", cw);
|
||||
|
Loading…
Reference in New Issue
Block a user