From 9fa85ee9bfa1848f5058d3c9e42aecb2e5865712 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 3 Feb 2011 16:25:42 +0000 Subject: [PATCH] osx: Add more checks to the redraw function The redraw function might be called during destruction phase, when the Stage state has not entirely been tore down. We need to be slightly more resilient to that scenario. --- clutter/osx/clutter-backend-osx.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/clutter/osx/clutter-backend-osx.c b/clutter/osx/clutter-backend-osx.c index 425bd8729..e4eb32461 100644 --- a/clutter/osx/clutter-backend-osx.c +++ b/clutter/osx/clutter-backend-osx.c @@ -192,14 +192,25 @@ clutter_backend_osx_ensure_context (ClutterBackend *backend, } static void -clutter_backend_osx_redraw (ClutterBackend *backend, ClutterStage *wrapper) +clutter_backend_osx_redraw (ClutterBackend *backend, + ClutterStage *wrapper) { - ClutterStageWindow *impl = _clutter_stage_get_window (wrapper); - ClutterStageOSX *stage_osx = CLUTTER_STAGE_OSX (impl); + ClutterStageWindow *impl; + ClutterStageOSX *stage_osx; + + if (CLUTTER_ACTOR_IN_DESTRUCTION (wrapper)) + return; + + impl = _clutter_stage_get_window (wrapper); + if (impl == NULL) + return; + + stage_osx = CLUTTER_STAGE_OSX (impl); CLUTTER_OSX_POOL_ALLOC(); - [stage_osx->view setNeedsDisplay: YES]; + if (stage_osx->view != NULL) + [stage_osx->view setNeedsDisplay: YES]; CLUTTER_OSX_POOL_RELEASE(); }