From e968f108727fa7052b2415c5364f23ddc2e5efc4 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 29 Jul 2006 01:53:18 +0000 Subject: [PATCH] Only do Armel Asselin's memory reduction patch in Paste in the Unicode build because in the ansi build wxWX2MBbuf is just a char* pointing into the text wxString's buffer git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/src/stc/ScintillaWX.cpp | 9 ++++++--- src/stc/ScintillaWX.cpp | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/contrib/src/stc/ScintillaWX.cpp b/contrib/src/stc/ScintillaWX.cpp index 764048fbc2..93893a4541 100644 --- a/contrib/src/stc/ScintillaWX.cpp +++ b/contrib/src/stc/ScintillaWX.cpp @@ -483,11 +483,14 @@ void ScintillaWX::Paste() { if (gotData) { wxString text = wxTextBuffer::Translate(data.GetText(), wxConvertEOLMode(pdoc->eolMode)); - data.SetText(wxEmptyString); // free the data object content wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text); - text = wxEmptyString; // free text - int len = strlen(buf); +#if wxUSE_UNICODE + // free up the old character buffer in case the text is real big + data.SetText(wxEmptyString); + text = wxEmptyString; +#endif + int len = strlen(buf); pdoc->InsertString(currentPos, buf, len); SetEmptySelection(currentPos + len); } diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index 764048fbc2..93893a4541 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -483,11 +483,14 @@ void ScintillaWX::Paste() { if (gotData) { wxString text = wxTextBuffer::Translate(data.GetText(), wxConvertEOLMode(pdoc->eolMode)); - data.SetText(wxEmptyString); // free the data object content wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text); - text = wxEmptyString; // free text - int len = strlen(buf); +#if wxUSE_UNICODE + // free up the old character buffer in case the text is real big + data.SetText(wxEmptyString); + text = wxEmptyString; +#endif + int len = strlen(buf); pdoc->InsertString(currentPos, buf, len); SetEmptySelection(currentPos + len); } -- 2.45.2