From d5c3783aedaadeeadf2b9e3396d285c9cbf76382 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Fri, 6 Feb 2026 16:05:38 +0900 Subject: [PATCH 1/5] Cancel pending GetData callback and null check input --- flutter/shell/platform/tizen/tizen_clipboard.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/flutter/shell/platform/tizen/tizen_clipboard.cc b/flutter/shell/platform/tizen/tizen_clipboard.cc index df289f2..7004972 100644 --- a/flutter/shell/platform/tizen/tizen_clipboard.cc +++ b/flutter/shell/platform/tizen/tizen_clipboard.cc @@ -120,9 +120,24 @@ void TizenClipboard::SetData(const std::string& data) { } bool TizenClipboard::GetData(ClipboardCallback on_data_callback) { + // Cancel any pending request to avoid leaving a previous callback hanging. + if (on_data_callback_) { + on_data_callback_(std::nullopt); + on_data_callback_ = nullptr; + } + on_data_callback_ = std::move(on_data_callback); Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display_); + if (!input) { + FT_LOG(Error) << "ecore_wl2_input_default_input_get() failed."; + if (on_data_callback_) { + on_data_callback_(std::nullopt); + on_data_callback_ = nullptr; + } + return false; + } + selection_offer_ = ecore_wl2_dnd_selection_get(input); if (!selection_offer_) { From d3951ce28b50a224b483dd26d8ea2bbd649c22e3 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Fri, 6 Feb 2026 17:16:34 +0900 Subject: [PATCH 2/5] Close fd on early SendData error paths Prevent SendData from exiting without closing fd. --- flutter/shell/platform/tizen/tizen_clipboard.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flutter/shell/platform/tizen/tizen_clipboard.cc b/flutter/shell/platform/tizen/tizen_clipboard.cc index 7004972..a157236 100644 --- a/flutter/shell/platform/tizen/tizen_clipboard.cc +++ b/flutter/shell/platform/tizen/tizen_clipboard.cc @@ -52,11 +52,17 @@ void TizenClipboard::SendData(void* event) { auto* send_event = reinterpret_cast(event); if (!send_event->type || strcmp(send_event->type, kMimeTypeTextPlain)) { FT_LOG(Error) << "Invaild mime type."; + if (send_event->fd >= 0) { + close(send_event->fd); + } return; } if (send_event->serial != selection_serial_) { FT_LOG(Error) << "The serial doesn't match."; + if (send_event->fd >= 0) { + close(send_event->fd); + } return; } From 693290d423eaa7f2f7d5e7b5d075bf97f8649370 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Fri, 6 Feb 2026 17:06:07 +0900 Subject: [PATCH 3/5] Add null check event in SendData/ReceiveData --- flutter/shell/platform/tizen/tizen_clipboard.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flutter/shell/platform/tizen/tizen_clipboard.cc b/flutter/shell/platform/tizen/tizen_clipboard.cc index a157236..9ee77ae 100644 --- a/flutter/shell/platform/tizen/tizen_clipboard.cc +++ b/flutter/shell/platform/tizen/tizen_clipboard.cc @@ -49,6 +49,9 @@ TizenClipboard::~TizenClipboard() { } void TizenClipboard::SendData(void* event) { + if (!event) { + return; + } auto* send_event = reinterpret_cast(event); if (!send_event->type || strcmp(send_event->type, kMimeTypeTextPlain)) { FT_LOG(Error) << "Invaild mime type."; @@ -71,6 +74,9 @@ void TizenClipboard::SendData(void* event) { } void TizenClipboard::ReceiveData(void* event) { + if (!event) { + return; + } auto* ready_event = reinterpret_cast(event); if (ready_event->data == nullptr || ready_event->len < 1) { From 0258a9ec7422c73a3c898c35f0fcbde2439e7550 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Wed, 11 Feb 2026 11:18:35 +0900 Subject: [PATCH 4/5] ++ --- flutter/shell/platform/tizen/tizen_clipboard.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/flutter/shell/platform/tizen/tizen_clipboard.cc b/flutter/shell/platform/tizen/tizen_clipboard.cc index 9ee77ae..93c3614 100644 --- a/flutter/shell/platform/tizen/tizen_clipboard.cc +++ b/flutter/shell/platform/tizen/tizen_clipboard.cc @@ -132,7 +132,6 @@ void TizenClipboard::SetData(const std::string& data) { } bool TizenClipboard::GetData(ClipboardCallback on_data_callback) { - // Cancel any pending request to avoid leaving a previous callback hanging. if (on_data_callback_) { on_data_callback_(std::nullopt); on_data_callback_ = nullptr; From c2a6db6dee0eeb966fdad9aa5a0221eeb99dfc30 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Wed, 11 Feb 2026 16:48:33 +0900 Subject: [PATCH 5/5] ++ --- flutter/shell/platform/tizen/tizen_clipboard.cc | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/flutter/shell/platform/tizen/tizen_clipboard.cc b/flutter/shell/platform/tizen/tizen_clipboard.cc index 93c3614..c14d16b 100644 --- a/flutter/shell/platform/tizen/tizen_clipboard.cc +++ b/flutter/shell/platform/tizen/tizen_clipboard.cc @@ -132,30 +132,15 @@ void TizenClipboard::SetData(const std::string& data) { } bool TizenClipboard::GetData(ClipboardCallback on_data_callback) { - if (on_data_callback_) { - on_data_callback_(std::nullopt); - on_data_callback_ = nullptr; - } - on_data_callback_ = std::move(on_data_callback); Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display_); - if (!input) { - FT_LOG(Error) << "ecore_wl2_input_default_input_get() failed."; - if (on_data_callback_) { - on_data_callback_(std::nullopt); - on_data_callback_ = nullptr; - } - return false; - } - selection_offer_ = ecore_wl2_dnd_selection_get(input); if (!selection_offer_) { FT_LOG(Error) << "ecore_wl2_dnd_selection_get() failed."; if (on_data_callback_) { - on_data_callback_(std::nullopt); on_data_callback_ = nullptr; } return false;