functions don't (de)reference arguments
Submitted by Robin Kreis
Link to original bug (#631545)
Description
Created attachment 171835 function argument refcount test case (crashes)
Hi!
Functions should increase the reference count on their arguments, including self, and refererence them again. In some cases, a function might remove the only (other) reference to one of its argument, turning it into a dangling reference. This happened to me in a "real-world" program, where a function happened to remove the "last" reference to self.
While the case seems unlikely, I don't think it's an error in the program, so vala should compile it correctly. Also, I can't see any downsides of (de)referencing arguments - at least those that are used. I've attached a contrived test case to show the issue. Compiling and running it generates a SIGSEGV on my machine.
Attachment 171835, "function argument refcount test case (crashes)":
fnarg_ref.vala
Version: 0.10.x