Argument 1: Cannot pass value to reference or output parameter #235

Closed
mmstick opened this Issue Mar 28, 2017 · 5 comments

Comments

Projects
None yet
4 participants

mmstick commented Mar 28, 2017

Happens with master and 4.3.3:

preferences_dialog.vala:276.34-276.37: error: Argument 1: Cannot pass value to reference or output parameter
				ignorepkgs_liststore.remove (iter);
				                             ^^^^
Contributor

guinux commented Mar 29, 2017

It's because you use vala 0.36, it has some gtk binding changes.
The solution is to change "(iter)" by "(ref iter)" but it makes the code unbuildable with 0.34 so I will change it when vala 0.36 hits the manjaro repos.

Owner

philmmanjaro commented May 11, 2017

I assume the patch would be something like this then:

diff --git a/src/preferences_dialog.vala b/src/preferences_dialog.vala
index b5bfea7..8bf338d 100644
--- a/src/preferences_dialog.vala
+++ b/src/preferences_dialog.vala
@@ -273,7 +273,7 @@ namespace Pamac {
 			Gtk.TreeIter? iter;
 			Gtk.TreeSelection selection = ignorepkgs_treeview.get_selection ();
 			if (selection.get_selected (null, out iter)) {
-				ignorepkgs_liststore.remove (iter);
+				ignorepkgs_liststore.remove (ref iter);
 				var ignorepkg_string = new StringBuilder ();
 				ignorepkgs_liststore.foreach ((model, path, iter) => {
 					GLib.Value name;
Owner

philmmanjaro commented May 11, 2017

Fixed via 2aaf2f7

alex285 commented Oct 15, 2017

same error with vala 0.38.2 and Meson 0.43.0

../src/preferences_dialog.vala:307.34-307.41: error: Argument 1: Cannot pass ref argument to non-reference parameter
				ignorepkgs_liststore.remove (ref iter);
				                             ^^^^^^^^

can you please re-open this issue?

Contributor

guinux commented Oct 15, 2017

I also use vala 0.38.2 and I don't have the issue.
/usr/share/vala-0.38/vapi/gtk+-3.0.vapi correctly contains "public bool remove (ref Gtk.TreeIter iter)" for ListStore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment