File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed
flutter/shell/platform/tizen Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -135,11 +135,11 @@ void PlatformChannel::HandleMethodCall(
135135 " Clipboard API only supports text." );
136136 return ;
137137 }
138- auto * result_ptr = result.release ();
139- if (!GetClipboardData ([result_ptr](std::optional<std::string> data) {
138+ std::shared_ptr<MethodResult<rapidjson::Document>> result_box{
139+ std::move (result)};
140+ if (!GetClipboardData ([result_box](std::optional<std::string> data) {
140141 if (!data.has_value ()) {
141- result_ptr->Error (kUnknownClipboardError , " Internal error." );
142- delete result_ptr;
142+ result_box->Error (kUnknownClipboardError , " Internal error." );
143143 return ;
144144 }
145145
@@ -150,11 +150,9 @@ void PlatformChannel::HandleMethodCall(
150150 document.AddMember (rapidjson::Value (kTextKey , allocator),
151151 rapidjson::Value (data.value (), allocator),
152152 allocator);
153- result_ptr->Success (document);
154- delete result_ptr;
153+ result_box->Success (document);
155154 })) {
156- result_ptr->Error (kUnknownClipboardError , " Internal error." );
157- delete result_ptr;
155+ result_box->Error (kUnknownClipboardError , " Internal error." );
158156 };
159157 } else if (method == kSetClipboardDataMethod ) {
160158 if (!arguments) {
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ TizenClipboard::TizenClipboard(TizenViewBase* view) {
4444}
4545
4646TizenClipboard::~TizenClipboard () {
47+ on_data_callback_ = nullptr ;
48+
4749 ecore_event_handler_del (send_handler);
4850 ecore_event_handler_del (receive_handler);
4951}
@@ -53,8 +55,13 @@ void TizenClipboard::SendData(void* event) {
5355 return ;
5456 }
5557 auto * send_event = reinterpret_cast <Ecore_Wl2_Event_Data_Source_Send*>(event);
56- if (!send_event->type || strcmp (send_event->type , kMimeTypeTextPlain )) {
57- FT_LOG (Error) << " Invaild mime type." ;
58+
59+ // TODO(jsuya): If the type of Ecore_Wl2_Event_Data_Source_Send is empty, it
60+ // is assumed to be "text/plain".
61+ if (!send_event->type || (strlen (send_event->type ) != 0 &&
62+ strcmp (send_event->type , kMimeTypeTextPlain ))) {
63+ FT_LOG (Error) << " Invaild mime type("
64+ << (send_event->type ? send_event->type : " null" ) << " )." ;
5865 if (send_event->fd >= 0 ) {
5966 close (send_event->fd );
6067 }
You can’t perform that action at this time.
0 commit comments