#include <stdlib.h>
#include <assert.h>
+#include <errno.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SHM_H
int id = shmget (IPC_PRIVATE, size, IPC_CREAT | S_IRWXU);
if (id == -1)
{
- msg_Err (vd, "shared memory allocation error: %m");
+ msg_Err (vd, "shared memory allocation error: %s",
+ vlc_strerror_c(errno));
return -1;
}
void *shm = shmat (id, NULL, 0 /* read/write */);
if (-1 == (intptr_t)shm)
{
- msg_Err (vd, "shared memory attachment error: %m");
+ msg_Err (vd, "shared memory attachment error: %s",
+ vlc_strerror_c(errno));
shmctl (id, IPC_RMID, 0);
return -1;
}
}
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;
}