From 0ac15903781b8deb9339027bdd4db2982f2629f3 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 11 Dec 2008 14:57:46 +0000 Subject: [PATCH] Lazily create the PangoContext on Text::init If we create the PangoContext for ClutterText inside the class initialization we might not have a Clutter main context yet. Ideally, we should store the Pango context inside the main context and create it on clutter_init(), but for now we can lazily create the PangoContext when we initialize a ClutterText instance for the first time. --- clutter/clutter-text.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 4b657d1da..d746279aa 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -1417,8 +1417,6 @@ clutter_text_class_init (ClutterTextClass *klass) ClutterBindingPool *binding_pool; GParamSpec *pspec; - _context = _clutter_context_create_pango_context (CLUTTER_CONTEXT ()); - g_type_class_add_private (klass, sizeof (ClutterTextPrivate)); gobject_class->set_property = clutter_text_set_property; @@ -1829,6 +1827,9 @@ clutter_text_init (ClutterText *self) ClutterTextPrivate *priv; int i; + if (G_UNLIKELY (_context == NULL)) + _context = _clutter_context_create_pango_context (CLUTTER_CONTEXT ()); + self->priv = priv = CLUTTER_TEXT_GET_PRIVATE (self); priv->alignment = PANGO_ALIGN_LEFT;