}
picture_t *XCB_picture_NewFromResource (const video_format_t *restrict fmt,
- const picture_resource_t *restrict res)
+ const picture_resource_t *restrict res,
+ xcb_connection_t *conn)
{
picture_t *pic = picture_NewFromResource (fmt, res);
if (unlikely(pic == NULL))
+ {
+ xcb_shm_seg_t seg = (uintptr_t)res->p_sys;
+
+ if (seg != 0)
+ xcb_shm_detach (conn, seg);
shmdt (res->p[0].p_pixels);
+ }
return pic;
}
int XCB_picture_Alloc (vout_display_t *, picture_resource_t *, size_t size,
xcb_connection_t *, xcb_shm_seg_t);
picture_t *XCB_picture_NewFromResource (const video_format_t *,
- const picture_resource_t *);
+ const picture_resource_t *,
+ xcb_connection_t *);
static inline xcb_shm_seg_t XCB_picture_GetSegment(const picture_t *pic)
{
if (XCB_picture_Alloc (vd, &res, size, sys->conn, seg))
break;
- pic_array[count] = XCB_picture_NewFromResource (&vd->fmt, &res);
+ pic_array[count] = XCB_picture_NewFromResource (&vd->fmt, &res,
+ sys->conn);
if (unlikely(pic_array[count] == NULL))
- {
- if (seg != 0)
- xcb_shm_detach (sys->conn, seg);
break;
- }
}
xcb_flush (sys->conn);
res.p[1].p_pixels = buf;
}
- pic_array[count] = XCB_picture_NewFromResource (&vd->fmt, &res);
+ pic_array[count] = XCB_picture_NewFromResource (&vd->fmt, &res,
+ p_sys->conn);
if (unlikely(pic_array[count] == NULL))
break;
}