[Vala] Some observation about chaining up constructors.



Hi.

I was trying to chain up some class constructors for non-GObject classes with 0.5.1/0.4.0.

The following code is generated. The instance is created twice.
If I change the parent class to GObject, the extra create_instance is immediately removed.

----
DOMAttr* dom_attr_construct (GType object_type, DOMDocument* owner, const char* name) {
    DOMAttr* self;
    g_return_val_if_fail (owner != NULL, NULL);
    g_return_val_if_fail (name != NULL, NULL);
    self = ((DOMAttr*) (g_type_create_instance (object_type)));
    self = ((DOMAttr*) (dom_node_construct (object_type, owner, DOM_NODE_TYPE_ATTRIBUTE, name)));
    return self;
}
----

Yu






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]