From d2bb57c3b2bc4ef7700735dcc4c6386b67fb4cc0 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 18 Mar 2010 14:15:33 +0000 Subject: [PATCH] Emit a critical warning if features are not initialized If you forgot to call clutter_init() then you currently end up with a warning saying that the stage cannot be initialized because the backend does not support multiple stages. Clearly not useful. We can catch some of the missing initialization in the features API, since we will likely end up asking for a feature at some point. --- clutter/clutter-feature.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/clutter/clutter-feature.c b/clutter/clutter-feature.c index 74bf87ba0..282783e2e 100644 --- a/clutter/clutter-feature.c +++ b/clutter/clutter-feature.c @@ -131,7 +131,10 @@ gboolean clutter_feature_available (ClutterFeatureFlags feature) { if (G_UNLIKELY (!__features)) - return FALSE; + { + g_critical ("Unable to check features. Have you initialized Clutter?"); + return FALSE; + } return (__features->flags & feature); } @@ -148,6 +151,12 @@ clutter_feature_available (ClutterFeatureFlags feature) ClutterFeatureFlags clutter_feature_get_all (void) { + if (G_UNLIKELY (!__features)) + { + g_critical ("Unable to check features. Have you initialized Clutter?"); + return FALSE; + } + return __features->flags; }