mirror of
https://github.com/brl/mutter.git
synced 2025-02-19 22:54:08 +00:00
surface-actor-x11: Assign X11 Display only if we have resources
free_damage and detach_pixmap functions are called inside dispose and an object can be disposed multiple times, even when the display is already closed. So, don't try to deference a possibly null-pointer, assigning the xdisplay too early, as if the X11 related resources have been unset, the server might not be open anymore. In fact, we assume that if we have a damage or a pixmap set, the display is still open. https://gitlab.gnome.org/GNOME/mutter/merge_requests/660 (cherry picked from commit d7d97f247767ace2655f1fd2a7bbee0c0c8cfb50)
This commit is contained in:
parent
ffa4279a96
commit
d4759df5bb
@ -69,11 +69,13 @@ free_damage (MetaSurfaceActorX11 *self)
|
|||||||
{
|
{
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||||
MetaDisplay *display = priv->display;
|
MetaDisplay *display = priv->display;
|
||||||
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
Display *xdisplay;
|
||||||
|
|
||||||
if (priv->damage == None)
|
if (priv->damage == None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
||||||
|
|
||||||
meta_x11_error_trap_push (display->x11_display);
|
meta_x11_error_trap_push (display->x11_display);
|
||||||
XDamageDestroy (xdisplay, priv->damage);
|
XDamageDestroy (xdisplay, priv->damage);
|
||||||
priv->damage = None;
|
priv->damage = None;
|
||||||
@ -85,12 +87,14 @@ detach_pixmap (MetaSurfaceActorX11 *self)
|
|||||||
{
|
{
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||||
MetaDisplay *display = priv->display;
|
MetaDisplay *display = priv->display;
|
||||||
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
|
||||||
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
||||||
|
Display *xdisplay;
|
||||||
|
|
||||||
if (priv->pixmap == None)
|
if (priv->pixmap == None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
||||||
|
|
||||||
/* Get rid of all references to the pixmap before freeing it; it's unclear whether
|
/* Get rid of all references to the pixmap before freeing it; it's unclear whether
|
||||||
* you are supposed to be able to free a GLXPixmap after freeing the underlying
|
* you are supposed to be able to free a GLXPixmap after freeing the underlying
|
||||||
* pixmap, but it certainly doesn't work with current DRI/Mesa
|
* pixmap, but it certainly doesn't work with current DRI/Mesa
|
||||||
|
Loading…
x
Reference in New Issue
Block a user