diff --git a/xpra/x11/bindings/ximage.pyx b/xpra/x11/bindings/ximage.pyx index f89cdb10d3..a82f2092b7 100644 --- a/xpra/x11/bindings/ximage.pyx +++ b/xpra/x11/bindings/ximage.pyx @@ -61,6 +61,7 @@ cdef extern from "Python.h": void PyBuffer_Release(Py_buffer *view) int PyBUF_ANY_CONTIGUOUS int PyBUF_READ + int PyBUF_WRITE cdef extern from "stdlib.h": int posix_memalign(void **memptr, size_t alignment, size_t size) @@ -315,6 +316,9 @@ cdef class XImageWrapper: cdef void *pix_ptr = self.get_pixels_ptr() if pix_ptr==NULL: return None + cdef int flags = PyBUF_READ + if self.pixels!=NULL: + flags = PyBUF_WRITE return PyMemoryView_FromMemory( pix_ptr, self.get_size(), PyBUF_READ) def get_sub_image(self, unsigned int x, unsigned int y, unsigned int w, unsigned int h):