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 731017 - Assigning transfer container arrays to owned variable results in extra free
Assigning transfer container arrays to owned variable results in extra free
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Arrays
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2014-05-30 23:40 UTC by Evan Nemerson
Modified: 2014-12-21 15:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test case (511 bytes, text/x-vala)
2014-05-30 23:40 UTC, Evan Nemerson
  Details
fix (unowned foo)[] to foo[] array copy (1.50 KB, patch)
2014-08-12 21:17 UTC, Luca Bruno
none Details | Review

Description Evan Nemerson 2014-05-30 23:40:11 UTC
Created attachment 277588 [details]
test case

If we have a function which returns a transfer container array, and assign the result to a fully owned variable, Vala will allow it but not generate any code to ref/copy the contents of the array as it would for a transfer none array.

Test case attached.
Comment 1 Luca Bruno 2014-05-31 10:53:33 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 700142 ***
Comment 2 Luca Bruno 2014-05-31 10:54:50 UTC
Sorry, after all we can handle this case rather than reporting an error. We can threat this differently.
Comment 3 Luca Bruno 2014-08-12 21:17:54 UTC
Created attachment 283233 [details] [review]
fix (unowned foo)[] to foo[] array copy

Proposed patch, still missing a test case that crashes without this patch. I'm going to commit after staging passes, unless you find any culprit. The patch is more delicate than what it seems.
Comment 4 Luca Bruno 2014-12-21 15:29:00 UTC
commit a6df1b95af42610a3c580188976a194ac8383d2a
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Tue Aug 12 23:14:25 2014 +0200

    codegen: Fix (unowned foo)[] to foo[] array copy
    
    Fixes bug 731017

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.