[Vala] x11-improvements 2/4: fix use-after-free in x11.vapi



Hi,

This works with Vala 0.10.4:

$ cat test.vala 
void main(){
        X.Display disp = new X.Display();
        stdout.printf("%s\n", disp.display_string());
}
$ valac --pkg=x11 test.vala && ./test 
:0.0 
$

This doesn't work with Vala 0.10.4:

$ cat test.vala 
void main(){
        X.Display disp = new X.Display();
        stdout.printf("%s\n", disp.display_string());
        stdout.printf("%s\n", disp.display_string());
}
$ valac --pkg=x11 test.vala && ./test 
:0.0

*** glibc detected *** ./test: double free or corruption (fasttop): 0x08509958 ***
[...]

This patch fixes the issues for me:

--- x11.vapi.orig       2011-03-14 14:07:46.731734844 +0100
+++ x11.vapi    2011-03-14 14:08:04.103728858 +0100
@@ -76,7 +76,7 @@
                public unowned Screen screen_by_id (int screen_number);
 
                [CCode (cname = "DisplayString")]
-               public string display_string ();
+               public unowned string display_string ();
 
                [CCode (cname = "XQLength")]
                public int event_queue_length ();

Best regards

Alexander Kurtz

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]