diff options
Diffstat (limited to 'clutter/x11/clutter-stage-x11.c')
-rw-r--r-- | clutter/x11/clutter-stage-x11.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clutter/x11/clutter-stage-x11.c b/clutter/x11/clutter-stage-x11.c index aecd978a7..84a6ab7dc 100644 --- a/clutter/x11/clutter-stage-x11.c +++ b/clutter/x11/clutter-stage-x11.c @@ -403,6 +403,7 @@ on_window_scaling_factor_notify (GObject *settings, static void clutter_stage_x11_unrealize (ClutterStageWindow *stage_window) { + ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window); ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window); if (clutter_stages_by_xid != NULL) @@ -415,6 +416,19 @@ clutter_stage_x11_unrealize (ClutterStageWindow *stage_window) GINT_TO_POINTER (stage_x11->xwin)); } + /* Clutter still uses part of the deprecated stateful API of Cogl + * (in particulart cogl_set_framebuffer). It means Cogl can keep an + * internal reference to the onscreen object we rendered to. In the + * case of foreign window, we want to avoid this, as we don't know + * what's going to happen to that window. + * + * The following call sets the current Cogl framebuffer to a dummy + * 1x1 one if we're unrealizing the current one, so Cogl doesn't + * keep any reference to the foreign window. + */ + if (cogl_get_draw_framebuffer () == COGL_FRAMEBUFFER (stage_cogl->onscreen)) + _clutter_backend_reset_cogl_framebuffer (stage_cogl->backend); + clutter_stage_window_parent_iface->unrealize (stage_window); } |