[Pkg-vala-maintainers] Bug#622773: vala 0.10 doesn't handle	fixed-size arrays correctly but 0.12 does
    Alexander Kurtz 
    kurtz.alex at googlemail.com
       
    Thu Apr 14 14:59:00 UTC 2011
    
    
  
Package: valac-0.10
Version: 0.10.4-1
Severity: normal
Tags: upstream fixed-upstream
Hi,
vala 0.10 doesn't handle fixed-size arrays correctly as it still thinks
they need to freed after use. With the attached minimal bindings for
pulseaudio and a simple test program, I get this:
	$ valac-0.10 --vapidir=. --pkg=libpulse Test.vala 
	Test.vala:2.2-2.26: warning: field `Test.map' never used
		PulseAudio.ChannelMap map;
		^^^^^^^^^^^^^^^^^^^^^^^^^
	/tmp/ccJ40C4Z.o: In function `test_finalize':
	Test.vala.c:(.text+0x152): undefined reference to `pulse_audio_channel_map_destroy'
	collect2: ld returned 1 exit status
	error: cc exited with status 256
	Compilation failed: 1 error(s), 1 warning(s)
	$ 
vala 0.12 behaves correctly:
	$ valac-0.12 --vapidir=. --pkg=libpulse Test.vala 
	Test.vala:2.2-2.26: warning: field `Test.map' never used
		PulseAudio.ChannelMap map;
		^^^^^^^^^^^^^^^^^^^^^^^^^
	Compilation succeeded - 1 warning(s)
	$ 
I guess that one of these [1] commits fixed the issue. If you have to
use vala 0.10, you can use something like this as a workaround (thanks
to Sean McNamara![2]):
	$ diff -u libpulse.vapi.old libpulse.vapi
	--- libpulse.vapi.old	2011-04-14 16:43:04.177836648 +0200
	+++ libpulse.vapi	2011-04-14 16:43:27.258335636 +0200
	@@ -1,6 +1,6 @@
	 [CCode (cheader_filename="pulse/pulseaudio.h")]
	 namespace PulseAudio {
	-        [CCode (cname="pa_channel_map")]
	+        [CCode (cname="pa_channel_map", has_destroy_function=false)]
		 public struct ChannelMap {
		         public uint8 channels;
		         public ChannelPosition map[32];
	$ valac-0.10 --vapidir=. --pkg=libpulse Test.vala 
	Test.vala:2.2-2.26: warning: field `Test.map' never used
		PulseAudio.ChannelMap map;
		^^^^^^^^^^^^^^^^^^^^^^^^^
	Compilation succeeded - 1 warning(s)
	$ 
There is no need to take any action about this since the bug is fixed in
the latest upstream stable release, but I wanted to document it here for
later reference. If I have some spare time, I might try to exactly
pinpoint the fix and backport it to vala 0.10, so please don't close
this bug report for now.
Best regards
Alexander Kurtz
[1] http://git.gnome.org/browse/vala/log/?qt=grep&q=fixed.*array
[2] https://tango.0pointer.de/pipermail/pulseaudio-discuss/2011-March/009695.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libpulse.vapi
Type: text/x-vala
Size: 412 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-vala-maintainers/attachments/20110414/9c1643bf/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.vala
Type: text/x-vala
Size: 88 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-vala-maintainers/attachments/20110414/9c1643bf/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-vala-maintainers/attachments/20110414/9c1643bf/attachment.pgp>
    
    
More information about the Pkg-vala-maintainers
mailing list