From 110d1b03e542e2618aecbcb11c143865e29a651d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 26 Nov 2016 18:44:00 +0100 Subject: [PATCH] Another blind fix for wxTextDataObject under macOS Use the length provided to SetData() instead of assuming it is NUL-terminated in the wxNEEDS_UTF16_FOR_TEXT_DATAOBJ case too, and not only in the wxNEEDS_UTF8_FOR_TEXT_DATAOBJ onem, as was done by the previous attempt to fix this in 20c130a57835261e7e7327fe85e95c76c5fe31af. Closes #9522. --- src/common/dobjcmn.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/dobjcmn.cpp b/src/common/dobjcmn.cpp index 10ba0a267a..2c48b383fc 100644 --- a/src/common/dobjcmn.cpp +++ b/src/common/dobjcmn.cpp @@ -394,13 +394,13 @@ bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const } bool wxTextDataObject::SetData(const wxDataFormat& format, - size_t WXUNUSED(len), + size_t len, const void *buf) { if ( buf == NULL ) return false; - SetText(GetConv(format).cMB2WX(static_cast(buf))); + SetText(GetConv(format).cMB2WC(static_cast(buf), len, NULL)); return true; }