backends: Protect from reentrancy in meta_cursor_sprite_load_from_theme

This function is supposedly not failable, so just move the theme_dirty
flag clearing to the beginning of the function. Protects against cases
where requesting a cursor image may result in it being loaded and set
as a texture, which emits ::texture-changed, which may end up requesting
the cursor image again.

https://bugzilla.gnome.org/show_bug.cgi?id=754806
This commit is contained in:
Carlos Garnacho 2017-11-17 14:07:20 +01:00
parent f45df4265d
commit 1790320ba3

View File

@ -229,6 +229,8 @@ meta_cursor_sprite_load_from_theme (MetaCursorSprite *self)
g_assert (self->cursor != META_CURSOR_NONE); g_assert (self->cursor != META_CURSOR_NONE);
self->theme_dirty = FALSE;
/* We might be reloading with a different scale. If so clear the old data. */ /* We might be reloading with a different scale. If so clear the old data. */
if (self->xcursor_images) if (self->xcursor_images)
{ {
@ -244,8 +246,6 @@ meta_cursor_sprite_load_from_theme (MetaCursorSprite *self)
image = meta_cursor_sprite_get_current_frame_image (self); image = meta_cursor_sprite_get_current_frame_image (self);
meta_cursor_sprite_load_from_xcursor_image (self, image); meta_cursor_sprite_load_from_xcursor_image (self, image);
self->theme_dirty = FALSE;
} }
MetaCursorSprite * MetaCursorSprite *