GNOME Bugzilla – Bug 600993
[PATCH] Pango.Attribute constructors transfer ownership, Pango.Scale not an enum
Last modified: 2009-11-07 20:02:24 UTC
Created attachment 147121 [details] pango: fix Pango.Attribute constructors' transfer of ownershiper and Pango.Scale As reported on the list (http://mail.gnome.org/archives/vala-list/2009-November/msg00021.html), code like this: 1: Pango.AttrList attr_list = new Pango.AttrList (); 2: Pango.Attribute attr_color = Pango.attr_foreground_new (red, green, blue); 3: Pango.Attribute attr_scale = Pango.attr_scale_new (Pango.Scale.SMALL); 4: attr_list.insert ((owned) attr_color); 5: attr_list.insert ((owned) attr_scale); 6: renderer.attributes = attr_list; currently fails to build because the Pango.Attribute constructor function return values are marked as unowned. The Pango.attr_*_new constructors return owned Pango.Attribute references. The attached patch adds the missing transfer_owned="1" attribute in pango.metadata. Also, Pango.Scale is not an enum. The attached patch turns it into a namespace with double constants in pango-custom.vala. This is needed so for Pango.attr_scale_new above. Otherwise Vala tries and fails to convert from enum Pango.Scale to double.
commit 4fb1dbe8ed8ed12ab558f9808266b08b7fda6fee Author: Philipp Zabel <philipp.zabel@gmail.com> Date: Fri Nov 6 19:43:24 2009 +0100 pango: fix Pango.Attribute constructors' transfer of ownership and Pango.Scale The Pango.attr_*_new constructors return owned Pango.Attribute references. Pango.Scale is not an enum. Turn it into a namespace with double constants. The latter is needed so for Pango.attr_scale_new, because it is impossible to convert from enum Pango.Scale to double. Fixes bug 600993.