Merge pull request #332 from fryshorts/xcursor-crash-fix

linux-capture: Fix possible crashes
master
Jim 2015-01-13 18:02:40 -08:00
commit 881b3bd52a
1 changed files with 7 additions and 0 deletions

View File

@ -44,6 +44,8 @@ static uint32_t *xcursor_pixels(XFixesCursorImage *xc) {
*/
static void xcursor_create(xcursor_t *data, XFixesCursorImage *xc) {
uint32_t *pixels = xcursor_pixels(xc);
if (!pixels)
return;
if (data->tex
&& data->last_height == xc->width
@ -82,6 +84,8 @@ void xcursor_destroy(xcursor_t *data) {
void xcursor_tick(xcursor_t *data) {
XFixesCursorImage *xc = XFixesGetCursorImage(data->dpy);
if (!xc)
return;
if (!data->tex || data->last_serial != xc->cursor_serial)
xcursor_create(data, xc);
@ -95,6 +99,9 @@ void xcursor_tick(xcursor_t *data) {
}
void xcursor_render(xcursor_t *data) {
if (!data->tex)
return;
gs_effect_t *effect = gs_get_effect();
gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image");
gs_effect_set_texture(image, data->tex);