}
public override CCodeExpression get_delegate_target_cexpression (Expression delegate_expr, out CCodeExpression delegate_target_destroy_notify) {
- delegate_target_destroy_notify = new CCodeConstant ("NULL");
+ delegate_target_destroy_notify = get_delegate_target_destroy_notify (delegate_expr);
- if (get_delegate_target_destroy_notify (delegate_expr) != null) {
- delegate_target_destroy_notify = get_delegate_target_destroy_notify (delegate_expr);
- }
- var target_expr = get_delegate_target (delegate_expr);
- if (target_expr == null) {
- return new CCodeConstant ("NULL");
- } else {
- return target_expr;
- }
+ return get_delegate_target (delegate_expr);
}
public override string get_delegate_target_destroy_notify_cname (string delegate_cname) {
}
if (expr.target_type is DelegateType) {
+ set_delegate_target_destroy_notify (expr, new CCodeConstant ("NULL"));
if (m.binding == MemberBinding.STATIC) {
set_delegate_target (expr, new CCodeConstant ("NULL"));
} else if (m.is_async_callback) {
string target_cname = get_delegate_target_cname (field.get_cname ());
string target_destroy_notify_cname = get_delegate_target_destroy_notify_cname (field.get_cname ());
+ set_delegate_target_destroy_notify (expr, new CCodeConstant ("NULL"));
if (field.no_delegate_target) {
set_delegate_target (expr, new CCodeConstant ("NULL"));
} else {
}
}
} else if (field.variable_type is DelegateType) {
+ set_delegate_target_destroy_notify (expr, new CCodeConstant ("NULL"));
if (field.no_delegate_target) {
set_delegate_target (expr, new CCodeConstant ("NULL"));
} else {
set_delegate_target (expr, new CCodeIdentifier (get_delegate_target_cname (get_variable_cname (local.name))));
if (expr.value_type.value_owned) {
set_delegate_target_destroy_notify (expr, new CCodeIdentifier (get_delegate_target_destroy_notify_cname (get_variable_cname (local.name))));
+ } else {
+ set_delegate_target_destroy_notify (expr, new CCodeConstant ("NULL"));
}
}
}
set_delegate_target (expr, target_expr);
if (expr.value_type.value_owned) {
set_delegate_target_destroy_notify (expr, delegate_target_destroy_notify);
+ } else {
+ set_delegate_target_destroy_notify (expr, new CCodeConstant ("NULL"));
}
}
}
var callback_param = new FormalParameter ("_callback_", callback_type);
callback_param.initializer = new NullLiteral (source_reference);
+ callback_param.initializer.target_type = callback_type.copy ();
callback_param.cparameter_position = -1;
callback_param.cdelegate_target_parameter_position = -0.9;