diff --git a/flutter/shell/platform/tizen/channels/app_control.cc b/flutter/shell/platform/tizen/channels/app_control.cc index 1662fb0..edbf649 100644 --- a/flutter/shell/platform/tizen/channels/app_control.cc +++ b/flutter/shell/platform/tizen/channels/app_control.cc @@ -67,6 +67,7 @@ AppControl::AppControl(app_control_h handle) : id_(next_id_++) { } AppControl::~AppControl() { + on_reply_ = nullptr; if (handle_) { app_control_destroy(handle_); } diff --git a/flutter/shell/platform/tizen/channels/app_control_channel.cc b/flutter/shell/platform/tizen/channels/app_control_channel.cc index 058b739..bbedf88 100644 --- a/flutter/shell/platform/tizen/channels/app_control_channel.cc +++ b/flutter/shell/platform/tizen/channels/app_control_channel.cc @@ -5,6 +5,7 @@ #include "app_control_channel.h" #include +#include #include #include #include @@ -169,15 +170,14 @@ void AppControlChannel::SendLaunchRequest( std::unique_ptr> result) { EncodableValueHolder wait_for_reply(arguments, "waitForReply"); if (wait_for_reply && *wait_for_reply) { - auto* result_ptr = result.release(); - auto on_reply = [result_ptr](const EncodableValue& response) { - result_ptr->Success(response); - delete result_ptr; + std::shared_ptr> result_box{std::move(result)}; + auto on_reply = [result_box](const EncodableValue& response) { + result_box->Success(response); }; + AppControlResult ret = app_control->SendLaunchRequestWithReply(on_reply); if (!ret) { - result_ptr->Error(ret.code(), ret.message()); - delete result_ptr; + result_box->Error(ret.code(), ret.message()); } } else { AppControlResult ret = app_control->SendLaunchRequest();