[Vala] Abuse of unowned?
- From: Pg Dr Hj Norjaidi bin Pg Tuah <norjaidi tuah ubd edu bn>
- To: "vala-list gnome org" <vala-list gnome org>
- Subject: [Vala] Abuse of unowned?
- Date: Tue, 8 Mar 2011 02:49:20 +0000
The following code crashes when compiled with 0.11.6
due to an attempt to deallocate the static string "bar"
(https://bugzilla.gnome.org/show_bug.cgi?id=642350).
struct Foo {
public string foo;
public string bar;
}
void main() {
Foo f = Foo() {foo = "foo", bar = N_("bar")};
}
As a work around, I change the struct strings to
unowned. Thus:
struct Foo {
public unowned string foo;
public unowned string bar;
}
That seems to work. But I'm apprehensive here.
Is my workaround safe? Am I abusing "unowned"?
Nice day
Nor Jaidi Tuah
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]