Re: [Vala] String manipulation => double free crash
- From: Frederik <scumm_fredo gmx net>
- To: vala-list gnome org
- Subject: Re: [Vala] String manipulation => double free crash
- Date: Sat, 26 Jul 2008 19:24:17 +0200
Andrew Flegg wrote:
Hi,
Attached is a very simple Vala program which demonstrates a problem
I'm having with 0.3.4.
To me this looks like a bug with the ?: operator, because if you
substitute it with if/else the code will work:
---------------------------------------------------------------------
public class DoubleFreeTest : Object {
public static void main() {
stdout.printf("%s\n", javaName("Gee"));
}
public static string javaName(string name) {
string result = "";
bool doneOne = false;
foreach (string bit in name.split("_")) {
if (doneOne) {
result += ucfirst(bit);
} else {
result += bit;
}
stdout.printf("%s\n", result);
doneOne = true;
}
return result;
}
private static string ucfirst(string arg) {
return arg.up(1) + arg.substring(1, arg.len() - 1);
}
}
---------------------------------------------------------------------
Recently I had a similar problem using the ?: operator in combination
with an assignment:
http://bugzilla.gnome.org/show_bug.cgi?id=543870
Perhaps it's the same.
Regards,
Frederik
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]