Fixed some issues reported on new Ubuntu 14.04 buildbots.

This commit is contained in:
Ryan C. Gordon 2014-04-19 02:17:34 -04:00
parent d2ea7cfea4
commit 60e0504077
2 changed files with 12 additions and 10 deletions

View File

@ -106,6 +106,7 @@ create_buffer_from_shm(Wayland_CursorData *d,
{ {
SDL_VideoDevice *vd = SDL_GetVideoDevice(); SDL_VideoDevice *vd = SDL_GetVideoDevice();
SDL_VideoData *data = (SDL_VideoData *) vd->driverdata; SDL_VideoData *data = (SDL_VideoData *) vd->driverdata;
struct wl_shm_pool *shm_pool;
int stride = width * 4; int stride = width * 4;
int size = stride * height; int size = stride * height;
@ -131,9 +132,7 @@ create_buffer_from_shm(Wayland_CursorData *d,
close (shm_fd); close (shm_fd);
} }
struct wl_shm_pool *shm_pool = wl_shm_create_pool(data->shm, shm_pool = wl_shm_create_pool(data->shm, shm_fd, size);
shm_fd,
size);
d->buffer = wl_shm_pool_create_buffer(shm_pool, d->buffer = wl_shm_pool_create_buffer(shm_pool,
0, 0,
width, width,
@ -280,18 +279,18 @@ Wayland_CreateSystemCursor(SDL_SystemCursor id)
break; break;
} }
SDL_Cursor *sdl_cursor = CreateCursorFromWlCursor (d, cursor); return CreateCursorFromWlCursor(d, cursor);
return sdl_cursor;
} }
static void static void
Wayland_FreeCursor(SDL_Cursor *cursor) Wayland_FreeCursor(SDL_Cursor *cursor)
{ {
Wayland_CursorData *d;
if (!cursor) if (!cursor)
return; return;
Wayland_CursorData *d = cursor->driverdata; d = cursor->driverdata;
/* Probably not a cursor we own */ /* Probably not a cursor we own */
if (!d) if (!d)

View File

@ -236,13 +236,16 @@ WL_EXPORT const struct wl_interface qt_extended_surface_interface = {
void void
Wayland_touch_create(SDL_VideoData *data, uint32_t id) Wayland_touch_create(SDL_VideoData *data, uint32_t id)
{ {
struct SDL_WaylandTouch *touch;
if (data->touch) { if (data->touch) {
Wayland_touch_destroy(data); Wayland_touch_destroy(data);
} }
data->touch = malloc(sizeof(struct SDL_WaylandTouch)); /* !!! FIXME: check for failure, call SDL_OutOfMemory() */
data->touch = SDL_malloc(sizeof(struct SDL_WaylandTouch));
struct SDL_WaylandTouch *touch = data->touch; touch = data->touch;
touch->touch_extension = wl_registry_bind(data->registry, id, &qt_touch_extension_interface, 1); touch->touch_extension = wl_registry_bind(data->registry, id, &qt_touch_extension_interface, 1);
qt_touch_extension_add_listener(touch->touch_extension, &touch_listener, data); qt_touch_extension_add_listener(touch->touch_extension, &touch_listener, data);
} }
@ -256,7 +259,7 @@ Wayland_touch_destroy(SDL_VideoData *data)
qt_touch_extension_destroy(touch->touch_extension); qt_touch_extension_destroy(touch->touch_extension);
} }
free(data->touch); SDL_free(data->touch);
data->touch = NULL; data->touch = NULL;
} }
} }