From 4b285e02bc85e92612485b5ebea568b90951be40 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 11 May 2009 18:17:30 +0100 Subject: [PATCH] [x11] Unset the GL context when re-realizing Setting the stage window using the set_stage_foreign() method will lead to a re-realization. We need to make sure that the Drawable currently associated to the GL context is set to None, to avoid a BadDrawable error or, if we're unlucky, a segfault in the X server. --- clutter/x11/clutter-stage-x11.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/clutter/x11/clutter-stage-x11.c b/clutter/x11/clutter-stage-x11.c index af2f87620..360417dbd 100644 --- a/clutter/x11/clutter-stage-x11.c +++ b/clutter/x11/clutter-stage-x11.c @@ -686,6 +686,12 @@ set_foreign_window_callback (ClutterActor *actor, fwd->stage_x11->xwin_height = fwd->geom.height; clutter_actor_set_geometry (actor, &fwd->geom); + + /* calling this with the stage unrealized will unset the stage + * from the GL context; once the stage is realized the GL context + * will be set again + */ + clutter_stage_ensure_current (CLUTTER_STAGE (actor)); } /** @@ -749,7 +755,7 @@ clutter_x11_set_stage_foreign (ClutterStage *stage, set_foreign_window_callback, &fwd); - CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_ACTOR_SYNC_MATRICES); + clutter_stage_ensure_viewport (stage); return TRUE; }