shell-recorder: Avoid a crash when the cursor texture is NULL

When running as a wayland compositor, MetaCursorTracker might
legitimately not have a displayed cursor because e.g. a client unsets
the cursor surface.

Note that, under an X session, the assumption that the tracker always
has a cursor texture is true because XFixesGetCursorImage() always
returns data even if the cursor isn't visible.

https://bugzilla.gnome.org/show_bug.cgi?id=767001
This commit is contained in:
Rui Matos 2016-06-06 20:28:34 +02:00
parent a300a3d6aa
commit 8954d99659

View File

@ -321,6 +321,9 @@ recorder_fetch_cursor_image (ShellRecorder *recorder)
guint8 *data; guint8 *data;
texture = meta_cursor_tracker_get_sprite (recorder->cursor_tracker); texture = meta_cursor_tracker_get_sprite (recorder->cursor_tracker);
if (!texture)
return;
width = cogl_texture_get_width (texture); width = cogl_texture_get_width (texture);
height = cogl_texture_get_height (texture); height = cogl_texture_get_height (texture);
stride = 4 * width; stride = 4 * width;