Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions flutter/shell/platform/tizen/channels/platform_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ void PlatformChannel::HandleMethodCall(
"Clipboard API only supports text.");
return;
}
auto* result_ptr = result.release();
if (!GetClipboardData([result_ptr](std::optional<std::string> data) {
std::shared_ptr<MethodResult<rapidjson::Document>> result_box{
std::move(result)};
if (!GetClipboardData([result_box](std::optional<std::string> data) {
if (!data.has_value()) {
result_ptr->Error(kUnknownClipboardError, "Internal error.");
delete result_ptr;
result_box->Error(kUnknownClipboardError, "Internal error.");
return;
}

Expand All @@ -150,11 +150,9 @@ void PlatformChannel::HandleMethodCall(
document.AddMember(rapidjson::Value(kTextKey, allocator),
rapidjson::Value(data.value(), allocator),
allocator);
result_ptr->Success(document);
delete result_ptr;
result_box->Success(document);
})) {
result_ptr->Error(kUnknownClipboardError, "Internal error.");
delete result_ptr;
result_box->Error(kUnknownClipboardError, "Internal error.");
};
} else if (method == kSetClipboardDataMethod) {
if (!arguments) {
Expand Down
11 changes: 9 additions & 2 deletions flutter/shell/platform/tizen/tizen_clipboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ TizenClipboard::TizenClipboard(TizenViewBase* view) {
}

TizenClipboard::~TizenClipboard() {
on_data_callback_ = nullptr;

ecore_event_handler_del(send_handler);
ecore_event_handler_del(receive_handler);
}
Expand All @@ -53,8 +55,13 @@ void TizenClipboard::SendData(void* event) {
return;
}
auto* send_event = reinterpret_cast<Ecore_Wl2_Event_Data_Source_Send*>(event);
if (!send_event->type || strcmp(send_event->type, kMimeTypeTextPlain)) {
FT_LOG(Error) << "Invaild mime type.";

// TODO(jsuya): If the type of Ecore_Wl2_Event_Data_Source_Send is empty, it
// is assumed to be "text/plain".
if (!send_event->type || (strlen(send_event->type) != 0 &&
strcmp(send_event->type, kMimeTypeTextPlain))) {
FT_LOG(Error) << "Invaild mime type("
<< (send_event->type ? send_event->type : "null") << ").";
if (send_event->fd >= 0) {
close(send_event->fd);
}
Expand Down