egl: Make sure to free the underlying egl objects when the display is freed
If the display has been setup up, we should destroy the underlying objects that the winsys has created. This can be done by calling the winsys->destroy_display() function in _free. Then, in that function, and for the NULL and GDL EGL platform we can destroy the surface we have created in the setup_display() function (through create_context()). This allows to have clutter create a "dummy" display in cogl_renderer_check_onscreen_template(), then free it, then recreate the context and the surface that will be the final ones. https://bugzilla.gnome.org/show_bug.cgi?id=655355
This commit is contained in:
parent
2c3827aced
commit
d4dc51849e
@ -49,9 +49,24 @@ cogl_display_error_quark (void)
|
|||||||
return g_quark_from_static_string ("cogl-display-error-quark");
|
return g_quark_from_static_string ("cogl-display-error-quark");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const CoglWinsysVtable *
|
||||||
|
_cogl_display_get_winsys (CoglDisplay *display)
|
||||||
|
{
|
||||||
|
return display->renderer->winsys_vtable;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_display_free (CoglDisplay *display)
|
_cogl_display_free (CoglDisplay *display)
|
||||||
{
|
{
|
||||||
|
const CoglWinsysVtable *winsys;
|
||||||
|
|
||||||
|
if (display->setup)
|
||||||
|
{
|
||||||
|
winsys = _cogl_display_get_winsys (display);
|
||||||
|
winsys->display_destroy (display);
|
||||||
|
display->setup = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (display->renderer)
|
if (display->renderer)
|
||||||
{
|
{
|
||||||
cogl_object_unref (display->renderer);
|
cogl_object_unref (display->renderer);
|
||||||
@ -104,12 +119,6 @@ cogl_display_new (CoglRenderer *renderer,
|
|||||||
return _cogl_display_object_new (display);
|
return _cogl_display_object_new (display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const CoglWinsysVtable *
|
|
||||||
_cogl_display_get_winsys (CoglDisplay *display)
|
|
||||||
{
|
|
||||||
return display->renderer->winsys_vtable;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cogl_display_setup (CoglDisplay *display,
|
cogl_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
GError **error)
|
||||||
|
@ -953,7 +953,14 @@ cleanup_context (CoglDisplay *display)
|
|||||||
egl_display->egl_context = EGL_NO_CONTEXT;
|
egl_display->egl_context = EGL_NO_CONTEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
|
#if defined (COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT) || \
|
||||||
|
defined (COGL_HAS_EGL_PLATFORM_GDL_SUPPORT)
|
||||||
|
if (egl_display->egl_surface != EGL_NO_SURFACE)
|
||||||
|
{
|
||||||
|
eglDestroySurface (egl_renderer->edpy, egl_display->egl_surface);
|
||||||
|
egl_display->egl_surface = EGL_NO_SURFACE;
|
||||||
|
}
|
||||||
|
#elif COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
|
||||||
if (egl_display->dummy_surface != EGL_NO_SURFACE)
|
if (egl_display->dummy_surface != EGL_NO_SURFACE)
|
||||||
{
|
{
|
||||||
eglDestroySurface (egl_renderer->edpy, egl_display->dummy_surface);
|
eglDestroySurface (egl_renderer->edpy, egl_display->dummy_surface);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user