Re: [PATCH] Setting variables in PD_DocumentRDF

From: Hubert Figuière <hfiguiere_at_teaser.fr>
Date: Sat Apr 14 2012 - 20:34:32 CEST

On 13/04/12 07:06 AM, Ingo Brückl wrote:
> I don't know whether it is a compiler issue, but the static variables get
> their "new PD_...Null" value *after* being PD_DocumentRDF::set, resulting
> in calling the PD_...Null functions rather than the GTK ones.

Where is ::set called from?

>
> If nobody objects, I will commit.

The only safe way for static global object is to use a function to get
them as there is no guarantee of initialization order.

Something like that:

static PD_SemanticItemFactory* getSemanticItemFactory()
{
        static PD_SemanticItemFactory* s_SemanticItemFactory = new
PD_SemanticItemFactoryNull;
        return s_SemanticItemFactory;
}

This guarantee the proper initialization.

Hub
Received on Sat Apr 14 20:43:59 2012

This archive was generated by hypermail 2.1.8 : Sat Apr 14 2012 - 20:43:59 CEST