GNOME Bugzilla – Bug 548550
The end_ptr parameter of the string.to_double should be weak.
Last modified: 2008-09-16 13:52:21 UTC
Please describe the problem: The end_ptr parameter of the string.to_double should be weak. Because strtod doesn't create any new string. Steps to reproduce: This code should work. protected override void from_string(string str){ weak string s = str; weak string end_ptr = null; int dimensions = 0; while(true) { s.to_double(out end_ptr); if((void*) s == (void*) end_ptr) break; s = end_ptr; dimensions ++ ; } this.dimensions = dimensions; s = str; for(int i = 0; i< dimensions; i++){ positions[i] = s.to_double(out s); dimensions ++ ; } } But ends up with libgdakit/temp.vala:70.17-70.27: error: Invalid assignment from owned expression to unowned variable s.to_double(out end_ptr); ^^^^^^^^^^^ libgdakit/temp.vala:78.32-78.36: error: Invalid assignment from owned expression to unowned variable positions[i] = s.to_double(out s); ^^^^^ Compilation failed: 2 error(s), 0 warning(s) Actual results: Expected results: Does this happen every time? Yes Other information: A workaround is to declare the strings as 'strong'. But it ends up with a messy ccode that duplicate the strings for many times.
Created attachment 117011 [details] [review] A patch
2008-09-16 Jürg Billeter <j@bitron.ch> * vapi/glib-2.0.vapi: Fix strtod, strtoul, and g_ascii_strtoll bindings, patch by Yu Feng, fixes bug 548550 Fixed in r1773.