After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 651871 - Gtk.TreeModel.get_path() return value can be null
Gtk.TreeModel.get_path() return value can be null
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings: GTK+ GStreamer WebKitGTK+
0.12.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2011-06-04 20:35 UTC by Sébastien Wilmet
Modified: 2011-06-05 14:18 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sébastien Wilmet 2011-06-04 20:35:10 UTC
The return type of Gtk.TreeModel.get_path() should be "Gtk.TreePath?" instead of "Gtk.TreePath".

In the API it's not mentioned if the return value can be null or not, but in the source code of Gtk.ListStore we can see that it can be null. And indeed, it's useful when the TreeIter is not valid.
Comment 1 Luca Bruno 2011-06-05 07:43:44 UTC
Return values are usually nullable even if they are not marked to be so. There are many methods that need nullable return value, it's a such small change that it's not worth it unless you're using the experimental non-null option for valac.
Comment 2 Sébastien Wilmet 2011-06-05 12:41:17 UTC
If null is returned with

> return null;

There is this warning:

> warning: `null' incompatible with return type `Gtk.TreePath`

But with

> return_val_if_fail (..., null);

there is no warning.

The purpose of this bug report was to avoid the warning message.
Comment 3 Luca Bruno 2011-06-05 14:13:02 UTC
I'm sorry I didn't notice it was an abstract method.
Comment 4 Luca Bruno 2011-06-05 14:18:22 UTC
commit c187aa853f1168559cfc8d2427aea8a72ea7d7bb
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Sun Jun 5 16:17:02 2011 +0200

    gtk+-2.0, gtk+-3.0: Mark TreeModel.get_path return value as nullable
    
    Fixes bug 651871.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.