Two test cases, the first one crashes the second one doesn't. Should validate the work around.
/* * build with: * valac --pkg gee-1.0 gee-test1.vala -o gee-test1 */
static int main(string[] args) { var map = new Gee.HashMap <string, string?> (); map["one"] = "one"; map["two"] = "two"; map["three"] = "three"; map["four"] = "four";
print ("map size is %d\n", map.size);
foreach (var v in map.entries) { print ("Found %s\n", v.value); map.unset(v.key); }
return 0; } ken@trabajo:~/src/gwibber/lp_959068$ cat examples/gee-test2.vala /* * build with: * valac --pkg gee-1.0 gee-test2.vala -o gee-test2 */
var to_remove = new GLib.List <string> ();
foreach (var v in map.entries) { print ("Found %s\n", v.value); to_remove.append (v.key); } foreach (var v in to_remove) map.unset(v);
return 0; }
« Back to merge proposal
Two test cases, the first one crashes the second one doesn't. Should validate the work around.
/*
* build with:
* valac --pkg gee-1.0 gee-test1.vala -o gee-test1
*/
static int main(string[] args)
{
var map = new Gee.HashMap <string, string?> ();
map["one"] = "one";
map["two"] = "two";
map["three"] = "three";
map["four"] = "four";
print ("map size is %d\n", map.size);
foreach (var v in map.entries) unset(v. key);
{
print ("Found %s\n", v.value);
map.
}
print ("map size is %d\n", map.size);
return 0; ~/src/gwibber/ lp_959068$ cat examples/ gee-test2. vala
}
ken@trabajo:
/*
* build with:
* valac --pkg gee-1.0 gee-test2.vala -o gee-test2
*/
static int main(string[] args)
{
var map = new Gee.HashMap <string, string?> ();
map["one"] = "one";
map["two"] = "two";
map["three"] = "three";
map["four"] = "four";
print ("map size is %d\n", map.size);
var to_remove = new GLib.List <string> ();
foreach (var v in map.entries) remove. append (v.key);
{
print ("Found %s\n", v.value);
to_
}
foreach (var v in to_remove)
map.unset(v);
print ("map size is %d\n", map.size);
return 0;
}