summaryrefslogtreecommitdiff
path: root/tests/delegates
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2011-05-18 22:47:25 +0200
committerJürg Billeter <j@bitron.ch>2011-05-18 22:59:45 +0200
commit9f1f6cac389f4c214870720cd09050b0f68ee82a (patch)
treef91e25c281f0c47eaa6f413f99c6f9f96e172311 /tests/delegates
parent0d5af7406b390f937acc1a7cff8bc926483587ff (diff)
downloadvala-9f1f6cac389f4c214870720cd09050b0f68ee82a.tar.gz
codegen: Discourage copying delegates with target
Target destroy notify cannot be copied, which means that memory management will often not work as expected. Use ownership transfer, unowned target variable, or extra closure instead.
Diffstat (limited to 'tests/delegates')
-rw-r--r--tests/delegates/bug595639.vala4
-rw-r--r--tests/delegates/bug639751.vala2
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/delegates/bug595639.vala b/tests/delegates/bug595639.vala
index 3278dfe15..55ba11b5e 100644
--- a/tests/delegates/bug595639.vala
+++ b/tests/delegates/bug595639.vala
@@ -1,7 +1,7 @@
delegate void Foo ();
-void do_foo (Foo foo) {
- Foo bar = foo;
+void do_foo (owned Foo foo) {
+ Foo bar = (owned) foo;
}
void main () {
diff --git a/tests/delegates/bug639751.vala b/tests/delegates/bug639751.vala
index 055a6deec..8c69a81ee 100644
--- a/tests/delegates/bug639751.vala
+++ b/tests/delegates/bug639751.vala
@@ -1,5 +1,5 @@
struct Foo {
- public SourceFunc bar;
+ public unowned SourceFunc bar;
}
void main() {