Ensures that the indicated type has been registered with the
type system, and its _class_init() method has been run.
Typically, calling the type’s _get_type() method (or using the
corresponding macro) will take care of this. In situations where a
type is looked up dynamically, however, you may need to explicitly call
g_type_ensure() to ensure expected types are registered before the
first lookup. This can happen when using custom widgets from a GTK
.ui file, for example.
Historically, _get_type() methods have sometimes been marked as
G_GNUC_CONST. This is incorrect, as the
first call to a _get_type() method has side-effects. These
annotations should be removed, as they can cause code to be optimized
out in unexpected ways by the compiler.
Ensures that the indicated
typehas been registered with the type system, and its _class_init() method has been run.Typically, calling the type’s
_get_type()method (or using the corresponding macro) will take care of this. In situations where a type is looked up dynamically, however, you may need to explicitly callg_type_ensure()to ensure expected types are registered before the first lookup. This can happen when using custom widgets from a GTK.uifile, for example.Historically,
_get_type()methods have sometimes been marked asG_GNUC_CONST. This is incorrect, as the first call to a_get_type()method has side-effects. These annotations should be removed, as they can cause code to be optimized out in unexpected ways by the compiler.