From d35bdcf202e03d33a2c9216d6632a17e0ca75739 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Wed, 11 Feb 2026 16:16:21 +0900 Subject: [PATCH 1/3] Prevent crash when mime type is empty I'm not sure exactly when an event is triggered with an empty type. However, even when copying plain text, the type can sometimes be empty. Therefore, if the type of the Ecore_Wl2_Event_Data_Source_Send event is empty, it is considered "text/plain." --- flutter/shell/platform/tizen/tizen_clipboard.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/flutter/shell/platform/tizen/tizen_clipboard.cc b/flutter/shell/platform/tizen/tizen_clipboard.cc index c14d16b..f40be2f 100644 --- a/flutter/shell/platform/tizen/tizen_clipboard.cc +++ b/flutter/shell/platform/tizen/tizen_clipboard.cc @@ -53,8 +53,12 @@ void TizenClipboard::SendData(void* event) { return; } auto* send_event = reinterpret_cast(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 << ")."; if (send_event->fd >= 0) { close(send_event->fd); } From 3d57cc4d9116a7a2fd77282ebc261547f1467040 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Wed, 11 Feb 2026 15:57:04 +0900 Subject: [PATCH 2/3] Fix memory safety issues in Clipboard --- .../platform/tizen/channels/platform_channel.cc | 14 ++++++-------- flutter/shell/platform/tizen/tizen_clipboard.cc | 2 ++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/flutter/shell/platform/tizen/channels/platform_channel.cc b/flutter/shell/platform/tizen/channels/platform_channel.cc index 1999309..d206490 100644 --- a/flutter/shell/platform/tizen/channels/platform_channel.cc +++ b/flutter/shell/platform/tizen/channels/platform_channel.cc @@ -135,11 +135,11 @@ void PlatformChannel::HandleMethodCall( "Clipboard API only supports text."); return; } - auto* result_ptr = result.release(); - if (!GetClipboardData([result_ptr](std::optional data) { + std::shared_ptr> result_box{ + std::move(result)}; + if (!GetClipboardData([result_box](std::optional data) { if (!data.has_value()) { - result_ptr->Error(kUnknownClipboardError, "Internal error."); - delete result_ptr; + result_box->Error(kUnknownClipboardError, "Internal error."); return; } @@ -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) { diff --git a/flutter/shell/platform/tizen/tizen_clipboard.cc b/flutter/shell/platform/tizen/tizen_clipboard.cc index f40be2f..254cce5 100644 --- a/flutter/shell/platform/tizen/tizen_clipboard.cc +++ b/flutter/shell/platform/tizen/tizen_clipboard.cc @@ -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); } From b9661abddf829e6180a3be0a8f56323e70e9fb75 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Wed, 11 Feb 2026 16:50:26 +0900 Subject: [PATCH 3/3] ++ --- flutter/shell/platform/tizen/tizen_clipboard.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flutter/shell/platform/tizen/tizen_clipboard.cc b/flutter/shell/platform/tizen/tizen_clipboard.cc index 254cce5..c8393aa 100644 --- a/flutter/shell/platform/tizen/tizen_clipboard.cc +++ b/flutter/shell/platform/tizen/tizen_clipboard.cc @@ -60,7 +60,8 @@ void TizenClipboard::SendData(void* event) { // 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 << ")."; + FT_LOG(Error) << "Invaild mime type(" + << (send_event->type ? send_event->type : "null") << ")."; if (send_event->fd >= 0) { close(send_event->fd); }