summaryrefslogtreecommitdiffstats
path: root/libavdevice/x11grab.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-20 20:20:56 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-21 12:00:11 +0200
commit1ee8fadb811f3b1ef370c7d6c7bf62088f1cc954 (patch)
tree00cc79fe8c41112c530d1646cecd33b27980b9b1 /libavdevice/x11grab.c
parent98abe16522be05096800dbf8e2ed4f4d8c9118c5 (diff)
downloadffmpeg-streaming-1ee8fadb811f3b1ef370c7d6c7bf62088f1cc954.zip
ffmpeg-streaming-1ee8fadb811f3b1ef370c7d6c7bf62088f1cc954.tar.gz
avdevice/x11grab: allocate just one Cursor
Fixes resource leak and Ticket2450 Reviewed-by: Carl Eugen Hoyos <cehoyos@ag.or.at> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice/x11grab.c')
-rw-r--r--libavdevice/x11grab.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index 6124006..7db1da6 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -78,6 +78,7 @@ struct x11grab {
int show_region; /**< set by a private option. */
char *framerate; /**< Set by a private option. */
+ Cursor c;
Window region_win; /**< This is used by show_region option. */
};
@@ -353,7 +354,6 @@ paint_mouse_pointer(XImage *image, struct x11grab *s)
* Anyone who performs further investigation of the xlib API likely risks
* permanent brain damage. */
uint8_t *pix = image->data;
- Cursor c;
Window w;
XSetWindowAttributes attr;
@@ -361,9 +361,10 @@ paint_mouse_pointer(XImage *image, struct x11grab *s)
if (image->bits_per_pixel != 24 && image->bits_per_pixel != 32)
return;
- c = XCreateFontCursor(dpy, XC_left_ptr);
+ if(!s->c)
+ s->c = XCreateFontCursor(dpy, XC_left_ptr);
w = DefaultRootWindow(dpy);
- attr.cursor = c;
+ attr.cursor = s->c;
XChangeWindowAttributes(dpy, w, CWCursor, &attr);
xcim = XFixesGetCursorImage(dpy);
OpenPOWER on IntegriCloud