Commit 590dd689 authored by Jürg Billeter's avatar Jürg Billeter
Browse files

codegen: Fix memory leak with owned delegate parameters in async methods

Fixes bug 683600.
parent 69189c92
......@@ -264,10 +264,19 @@ public class Vala.GAsyncModule : GSignalModule {
var old_captured = param.captured;
param.captured = false;
current_method.coroutine = false;
var value = load_parameter (param);
if (requires_copy (param_type) && !param.variable_type.value_owned) {
value = copy_value (value, param);
TargetValue value;
if (param.variable_type.value_owned) {
// do not use load_parameter for reference/ownership transfer
// otherwise delegate destroy notify will not be moved
value = get_parameter_cvalue (param);
} else {
value = load_parameter (param);
if (requires_copy (param_type)) {
value = copy_value (value, param);
}
}
current_method.coroutine = true;
store_parameter (param, value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment