Index: templates/TypeBuilder_cpp.template |
diff --git a/templates/TypeBuilder_cpp.template b/templates/TypeBuilder_cpp.template |
index 23b6f5399089609af71ac4c5878aae9e171e0a62..f90dbd1064a8e1a8ce055b93d3b39a42367b21a6 100644 |
--- a/templates/TypeBuilder_cpp.template |
+++ b/templates/TypeBuilder_cpp.template |
@@ -355,6 +355,7 @@ DispatchResponse::Status DispatcherImpl::{{command.name}}(int callId, std::uniqu |
{% endif %} |
return response.status(); |
{% else %} |
+ std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr(); |
std::unique_ptr<{{command.name | to_title_case}}CallbackImpl> callback(new {{command.name | to_title_case}}CallbackImpl(weakPtr(), callId, nextCallbackId())); |
m_backend->{{command.name | to_method_case}}( |
{%- for property in command.parameters -%} |
@@ -367,7 +368,7 @@ DispatchResponse::Status DispatcherImpl::{{command.name}}(int callId, std::uniqu |
{%- endfor -%} |
{%- if command.parameters -%}, {% endif -%} |
std::move(callback)); |
- return lastCallbackFallThrough() ? DispatchResponse::kFallThrough : DispatchResponse::kAsync; |
+ return (weak->get() && weak->get()->lastCallbackFallThrough()) ? DispatchResponse::kFallThrough : DispatchResponse::kAsync; |
{% endif %} |
} |
{% endfor %} |