更新时间:2023-11-11 12:05:04
在lambda中,没有.标准方法是这样的:
Inside a lambda, no. The standard approach is this:
class Foo : Whatever {
public Foo {
unowned Foo unowned_this = this;
this.bar_signal.connect(unowned_this.bar_handler);
}
private void bar_handler() {
...
}
}
这不会捕获对此的引用,但是您也无法捕获任何其他变量.
This doesn't capture a reference to this, but you also cannot capture any other variables.