[cairo-commit] src/cairo-xlib-surface-shm.c

Bryce Harrington bryce at kemper.freedesktop.org
Thu Mar 5 17:28:04 PST 2015


 src/cairo-xlib-surface-shm.c |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit e7fc8f405beeeb1048f69fe22923170a137b805e
Author: Henry (Yu) Song <henry.song at samsung.com>
Date:   Thu Mar 5 00:20:42 2015 +0000

    xlib: Remove queued event from _XReadEvents
    
    Following patch fixes a memory leak in xlib surface.
    
    Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>

diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
index fb40699..9b4dea5 100644
--- a/src/cairo-xlib-surface-shm.c
+++ b/src/cairo-xlib-surface-shm.c
@@ -670,6 +670,7 @@ _cairo_xlib_shm_surface_flush (void *abstract_surface, unsigned flags)
     cairo_xlib_shm_surface_t *shm = abstract_surface;
     cairo_xlib_display_t *display;
     Display *dpy;
+    _XQEvent *qev;
     cairo_status_t status;
 
     if (shm->active == 0)
@@ -694,6 +695,10 @@ _cairo_xlib_shm_surface_flush (void *abstract_surface, unsigned flags)
     while (! seqno_passed (shm->active, LastKnownRequestProcessed (dpy))) {
 	LockDisplay(dpy);
 	_XReadEvents(dpy);
+	while (dpy->head) {
+	    qev = dpy->head;
+	    _XDeq (dpy, NULL, qev);
+	}
 	UnlockDisplay(dpy);
     }
 


More information about the cairo-commit mailing list