You're declaring v as List<string>, but it should be List<weak string>.
You could also just do var v = ht.get_values() and Vala would
automatically do the right thing.



On Wed, 2008-12-03 at 12:42 +0100, Daniele Benucci wrote:
> using GLib;
> 
> public class HashTest : GLib.Object {
>     private HashTable<string,string> ht;
> 
>     public void run () throws DBus.Error, GLib.Error {
>         for (int i=0; i<5; i++){
>             List<string> v = ht.get_values();
>             foreach (string s in v)
>                 message("%d: %s",i,s);
>         }
>     }
> 
>     public HashTest (){
>         ht = new HashTable<string,string>(str_hash, str_equal);
>         ht.insert("one","1");
>         ht.insert("two","2");
>         ht.insert("three","3");
>     }
> 
>     static int main (string[] args) {
>         var test = new HashTest ();
>         test.run ();



>         return 0;
>     }
> }

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

_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to