Fix crash when cursor theme lookup failed

meta_cursor_reference_from_theme() may return %NULL on failure,
in which case we currently crash when trying to release it.
This commit is contained in:
Florian Müllner 2014-04-29 22:14:34 +02:00
parent b773898a60
commit d9a2443e53
2 changed files with 4 additions and 2 deletions

View File

@ -1709,7 +1709,8 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
cursor_ref = meta_cursor_reference_from_theme (cursor);
meta_cursor_tracker_set_grab_cursor (tracker, cursor_ref);
meta_cursor_reference_unref (cursor_ref);
if (cursor_ref)
meta_cursor_reference_unref (cursor_ref);
if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
display->grab_have_pointer = TRUE;

View File

@ -1376,7 +1376,8 @@ meta_screen_update_cursor (MetaScreen *screen)
cursor_ref = meta_cursor_reference_from_theme (cursor);
meta_cursor_tracker_set_root_cursor (tracker, cursor_ref);
meta_cursor_reference_unref (cursor_ref);
if (cursor_ref)
meta_cursor_reference_unref (cursor_ref);
/* Set a cursor for X11 applications that don't specify their own */
xcursor = meta_display_create_x_cursor (display, cursor);