diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2011-07-26 17:39:44 +0300 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2011-07-29 11:50:15 +0100 |
commit | d4dc51849e1e92f141fd71bf9c13c570db47a2f0 (patch) | |
tree | 969f0fd217c8df1993b63169951cd744996e4e0c /cogl/cogl-display.c | |
parent | 2c3827aced46547c8e8ab441e1ff2ebf3e02b624 (diff) | |
download | cogl-d4dc51849e1e92f141fd71bf9c13c570db47a2f0.tar.gz |
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
Diffstat (limited to 'cogl/cogl-display.c')
-rw-r--r-- | cogl/cogl-display.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/cogl/cogl-display.c b/cogl/cogl-display.c index ec13aa45..1c64fe9e 100644 --- a/cogl/cogl-display.c +++ b/cogl/cogl-display.c @@ -49,9 +49,24 @@ cogl_display_error_quark (void) 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 _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) { cogl_object_unref (display->renderer); @@ -104,12 +119,6 @@ cogl_display_new (CoglRenderer *renderer, return _cogl_display_object_new (display); } -static const CoglWinsysVtable * -_cogl_display_get_winsys (CoglDisplay *display) -{ - return display->renderer->winsys_vtable; -} - gboolean cogl_display_setup (CoglDisplay *display, GError **error) |