Skip to content

Commit 1550cab

Browse files
committed
Fix tcore clipboard transfer handling
1 parent 8db6780 commit 1550cab

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

flutter/shell/platform/tizen/tizen_clipboard.cc

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,13 @@ void TizenClipboard::SendData(void* event) {
8787
(strlen(mime_type) != 0 && strcmp(mime_type, kMimeTypeTextPlain))) {
8888
FT_LOG(Error) << "Invaild mime type(" << (mime_type ? mime_type : "null")
8989
<< ").";
90+
free(mime_type);
9091
if (fd >= 0) {
9192
close(fd);
9293
}
9394
return;
9495
}
96+
free(mime_type);
9597

9698
if (serial != selection_serial_) {
9799
FT_LOG(Error) << "The serial doesn't match.";
@@ -213,8 +215,21 @@ bool TizenClipboard::GetData(ClipboardCallback on_data_callback) {
213215
return false;
214216
}
215217

216-
tizen_core_wl_data_receive(selection_offer_,
217-
const_cast<char*>(kMimeTypeTextPlain));
218+
if (tizen_core_wl_data_accept(selection_offer_, kMimeTypeTextPlain) !=
219+
TIZEN_CORE_WL_ERROR_NONE) {
220+
if (on_data_callback_) {
221+
on_data_callback_ = nullptr;
222+
}
223+
return false;
224+
}
225+
if (tizen_core_wl_data_receive(selection_offer_,
226+
const_cast<char*>(kMimeTypeTextPlain)) !=
227+
TIZEN_CORE_WL_ERROR_NONE) {
228+
if (on_data_callback_) {
229+
on_data_callback_ = nullptr;
230+
}
231+
return false;
232+
}
218233
return true;
219234
}
220235

@@ -250,8 +265,8 @@ bool TizenClipboard::HasStrings() {
250265
for (int i = 0; i < mime_count; ++i) {
251266
if (mimes[i] && !strcmp(kMimeTypeTextPlain, mimes[i])) {
252267
found = true;
253-
break;
254268
}
269+
free(mimes[i]);
255270
}
256271
free(mimes);
257272
return found;

0 commit comments

Comments
 (0)