GNOME Bugzilla – Bug 514864
nullable struct parameter dereferenced
Last modified: 2008-03-15 02:49:09 UTC
Please describe the problem: For a method who's signature is public bool iter_nth_child (out Gtk.TreeIter iter, weak Gtk.TreeIter? parent, int n) vala generates for if ( ref parent != null) the following C code: parent = *_parent_p; //segfaults here if (&parent != NULL) Steps to reproduce: Actual results: The code segfaults as parent can be null Expected results: the _parent_p should not be dereferenced if I only use ref parent Does this happen every time? yes Other information: Vala 0.1.6
if (ref parent != null) This is invalid code, it should be if (parent != null) However, the crash will still happen, which is obviously a bug.
*** Bug 520795 has been marked as a duplicate of this bug. ***
*** Bug 522353 has been marked as a duplicate of this bug. ***
Created attachment 107327 [details] [review] Proposed fix
2008-03-15 Jürg Billeter <j@bitron.ch> * gobject/valaccodegenerator.vala, gobject/valaccodegeneratormemberaccess.vala, gobject/valaccodegeneratormethod.vala: fix runtime crash when using nullable struct parameters, patch by Alberto Ruiz, fixes bug 514864 Fixed in r1127.