wayland: Don't set cursor surface scale when we don't have a surface
The setting of the the surface scale even when the surface is not created from a surface was introduced due to a crash when getting the buffers when dividing by the scale. The only reason I can see this is that we get the buffer from a non-existing surface when the wl_cursor has not yet been set. Instead, use the name field to avoid trying to use the non-existing surface, effectively avoiding the division-by-zero that way. https://bugzilla.gnome.org/show_bug.cgi?id=746141
This commit is contained in:
		| @ -173,7 +173,7 @@ _gdk_wayland_cursor_get_buffer (GdkCursor *cursor, | |||||||
|  |  | ||||||
|       return wl_cursor_image_get_buffer (image); |       return wl_cursor_image_get_buffer (image); | ||||||
|     } |     } | ||||||
|   else /* From surface */ |   else if (wayland_cursor->name == NULL) /* From surface */ | ||||||
|     { |     { | ||||||
|       *hotspot_x = wayland_cursor->surface.hotspot_x; |       *hotspot_x = wayland_cursor->surface.hotspot_x; | ||||||
|       *hotspot_y = wayland_cursor->surface.hotspot_y; |       *hotspot_y = wayland_cursor->surface.hotspot_y; | ||||||
| @ -186,9 +186,9 @@ _gdk_wayland_cursor_get_buffer (GdkCursor *cursor, | |||||||
|  |  | ||||||
|       if (wayland_cursor->surface.cairo_surface) |       if (wayland_cursor->surface.cairo_surface) | ||||||
|         return _gdk_wayland_shm_surface_get_wl_buffer (wayland_cursor->surface.cairo_surface); |         return _gdk_wayland_shm_surface_get_wl_buffer (wayland_cursor->surface.cairo_surface); | ||||||
|       else |  | ||||||
|         return NULL; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |   return NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| guint | guint | ||||||
| @ -273,7 +273,6 @@ _gdk_wayland_display_get_cursor_for_name (GdkDisplay  *display, | |||||||
|                           "display", display, |                           "display", display, | ||||||
|                           NULL); |                           NULL); | ||||||
|   private->name = g_strdup (name); |   private->name = g_strdup (name); | ||||||
|   private->surface.scale = 1; |  | ||||||
|  |  | ||||||
|   /* Blank cursor case */ |   /* Blank cursor case */ | ||||||
|   if (!name || g_str_equal (name, "blank_cursor")) |   if (!name || g_str_equal (name, "blank_cursor")) | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Jonas Ådahl
					Jonas Ådahl