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 736016 - Ownership for assignments from methods throwing an error isn't checked
Ownership for assignments from methods throwing an error isn't checked
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Semantic Analyzer
0.25.x
Other Linux
: Normal blocker
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on: 736774
Blocks:
 
 
Reported: 2014-09-04 09:08 UTC by Rico Tzschichholz
Modified: 2018-05-22 15:18 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Rico Tzschichholz 2014-09-04 09:08:52 UTC
A simple test-case which shows the problem.


const string CONSTANT = "constant";

string get_owned_with_error () throws Error
{
	return CONSTANT;
}

unowned string get_result_fail ()
{
	unowned string foo_unowned;

	foo_unowned = get_owned_with_error ();

	return foo_unowned;
}

void main ()
{
	assert (get_result_fail () == CONSTANT);
}
Comment 1 Luca Bruno 2014-09-04 11:23:21 UTC
Seems that the bad commit is:
commit db462e6f919da758fbb2f4e7b3cbbf2897ec852b
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Tue Jan 28 20:34:47 2014 +0100

    Fix regression in method calls that throw errors with Value target type
    
    Related to bug 723009
Comment 2 Luca Bruno 2014-09-05 08:14:15 UTC
Ok pulling the trigger. It may break applications because this is an error.
It's worth noting this was an error in valac 0.22, the regression was silently introduced in valac 0.24. Now we're fixing it back re-enabling the error.
Sorry for the inconvenience.

Also the fix is very delicate, if you find any culprits while running your software please report back as soon as possible. Thanks.

On a side note, this regression was due to missing negative regression tests. Our test suite has only positive tests. In this case we want the test to fail at compile-time, but we don't have proper support for this in our test suite.

commit ba1fa0759989dcbb9046c7dfc06cce6c4aa23411
Author: Luca Bruno <luca.bruno@immobiliare.it>
Date:   Thu Sep 4 18:26:21 2014 +0200

    Fix regression when assigning owned expressions to unowned variables.
    
    The regression was introduced by db462e6f919da758fb.
    
    Fixes bug 736016

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.
Comment 3 Jim Nelson 2014-09-17 00:40:49 UTC
I'm currently looking at a problem introduced by this commit: bug #736774.
Comment 4 Luca Bruno 2014-09-19 12:46:05 UTC
Reverted:

commit c08dd2c82dcfe42f2f6fb23333eadf63ed2d7f22
Author: Luca Bruno <luca.bruno@immobiliare.it>
Date:   Fri Sep 19 14:43:45 2014 +0200

    Revert "Fix regression when assigning owned expressions to unowned variables."
    
    This reverts commit ba1fa0759989dcbb9046c7dfc06cce6c4aa23411.
    
    Due to bug #736774

Better not have this in the next vala stable if I'm not able to fix it in time.
Comment 5 GNOME Infrastructure Team 2018-05-22 15:18:11 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/475.