evas engines: do not immediately free native surface when unsetting it

Summary:
this is a longstanding issue which was exposed by recent patches to standardize
object lifecycles. when a native surface is used by multiple images, unsetting
the surface from one image must not destroy the native surface or else the
remaining images

fix T6970

@fix

Reviewers: ManMower

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Maniphest Tasks: T6970

Differential Revision: https://phab.enlightenment.org/D6235
This commit is contained in:
Mike Blumenkrantz 2018-06-05 12:13:08 -05:00 committed by Derek Foreman
parent 4ec261064f
commit a6731320f5
5 changed files with 19 additions and 42 deletions

View File

@ -912,19 +912,14 @@ eng_image_native_set(void *engine EINA_UNUSED, void *data, void *image, void *na
}
}
if ((!ns) && (!img->native.data)) return img;
evas_outbuf_use(ob);
if (img->native.data)
if (!ns)
{
if (img->native.func.free)
img->native.func.free(img);
glsym_evas_gl_common_image_native_disable(img);
glsym_evas_gl_common_image_free(img);
return NULL;
}
if (!ns) return img;
if (ns->type == EVAS_NATIVE_SURFACE_WL)
{
wlid = wl_buf;

View File

@ -1223,19 +1223,14 @@ eng_image_native_set(void *engine, void *image, void *native)
}
}
if ((!ns) && (!img->native.data)) return img;
evas_outbuf_use(ob);
if (img && img->native.data)
if (!ns)
{
if (img->native.func.free)
img->native.func.free(img);
glsym_evas_gl_common_image_native_disable(img);
glsym_evas_gl_common_image_free(img);
return NULL;
}
if (!ns) return img;
if (ns->type == EVAS_NATIVE_SURFACE_WL_DMABUF)
{
wlid = wl_buf;

View File

@ -484,18 +484,13 @@ eng_image_native_set(void *engine, void *image, void *native)
}
}
}
if ((!ns) && (!im->native.data)) return im;
gl_generic_window_find(engine);
if (im->native.data)
{
if (im->native.func.free)
im->native.func.free(im);
evas_gl_common_image_native_disable(im);
}
if (!ns) return im;
if (!ns)
{
evas_gl_common_image_free(im);
return NULL;
}
if (ns->type == EVAS_NATIVE_SURFACE_OPENGL)
{

View File

@ -2384,16 +2384,12 @@ eng_image_native_set(void *engine, void *image, void *native)
#endif
}
}
if ((!ns) && (!im->native.data)) return im;
if (!ns)
{
glsym_evas_gl_common_image_free(im);
return NULL;
}
if (im->native.data)
{
if (im->native.func.free)
im->native.func.free(im);
glsym_evas_gl_common_image_native_disable(im);
}
if (!ns) return im;
if (ns->type == EVAS_NATIVE_SURFACE_X11)
{

View File

@ -1083,18 +1083,14 @@ eng_image_native_set(void *engine, void *image, void *native)
}
}
if ((!ns) && (!img->native.data)) return img;
eng_window_use(ob);
if (img->native.data)
if (!ns)
{
if (img->native.func.free)
img->native.func.free(img);
glsym_evas_gl_common_image_native_disable(img);
glsym_evas_gl_common_image_free(img);
return NULL;
}
if (!ns) return img;
if (ns->type == EVAS_NATIVE_SURFACE_WL)
{