]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch from Armel Asselin that reduces memory required when
authorRobin Dunn <robin@alldunn.com>
Wed, 28 Jun 2006 19:32:18 +0000 (19:32 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 28 Jun 2006 19:32:18 +0000 (19:32 +0000)
pasting text and when sending events.

Comment out some unneeded asserts.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39875 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

contrib/src/stc/ScintillaWX.cpp
contrib/src/stc/scintilla/src/Editor.cxx
contrib/src/stc/stc.cpp
contrib/src/stc/stc.cpp.in
src/stc/ScintillaWX.cpp
src/stc/scintilla/src/Editor.cxx
src/stc/stc.cpp
src/stc/stc.cpp.in

index 2d793a91570daeaea004b711dfe922cf58d2e96b..a27fe5126b5596560b89fa1f094997f5dc41e690 100644 (file)
@@ -484,7 +484,10 @@ 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);
         pdoc->InsertString(currentPos, buf, len);
         SetEmptySelection(currentPos + len);
index 0aa2a651c63278332608969654a6653dddf64fbf..2c0615e15012422d02230c6dec9086659179e236 100644 (file)
@@ -213,7 +213,7 @@ void LineLayoutCache::Allocate(int length_) {
 }
 
 void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
-       PLATFORM_ASSERT(useCount == 0);
+//     PLATFORM_ASSERT(useCount == 0);
        int lengthForLevel = 0;
        if (level == llcCaret) {
                lengthForLevel = 1;
@@ -239,7 +239,7 @@ void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
 }
 
 void LineLayoutCache::Deallocate() {
-       PLATFORM_ASSERT(useCount == 0);
+//     PLATFORM_ASSERT(useCount == 0);
        for (int i = 0; i < length; i++)
                delete cache[i];
        delete []cache;
index f2b2b1b8c14dae39a95c47a56c08424b9b6627d0..f42348d4bf47972a51ef777770942176e5eb4295 100644 (file)
@@ -3186,12 +3186,7 @@ static void SetEventText(wxStyledTextEvent& evt, const char* text,
                          size_t length) {
     if(!text) return;
 
-    // The unicode conversion MUST have a null byte to terminate the
-    // string so move it into a buffer first and give it one.
-    wxMemoryBuffer buf(length+1);
-    buf.AppendData((void*)text, length);
-    buf.AppendByte(0);
-    evt.SetText(stc2wx(buf));
+    evt.SetText(stc2wx(text, length));
 }
 
 
index b99563feded2b5962193e8d9c7be766baeb3cfb9..2a9806a68a2adf03772aea3010017a41e22ce928 100644 (file)
@@ -854,12 +854,7 @@ static void SetEventText(wxStyledTextEvent& evt, const char* text,
                          size_t length) {
     if(!text) return;
 
-    // The unicode conversion MUST have a null byte to terminate the
-    // string so move it into a buffer first and give it one.
-    wxMemoryBuffer buf(length+1);
-    buf.AppendData((void*)text, length);
-    buf.AppendByte(0);
-    evt.SetText(stc2wx(buf));
+    evt.SetText(stc2wx(text, length));
 }
 
 
index 2d793a91570daeaea004b711dfe922cf58d2e96b..a27fe5126b5596560b89fa1f094997f5dc41e690 100644 (file)
@@ -484,7 +484,10 @@ 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);
         pdoc->InsertString(currentPos, buf, len);
         SetEmptySelection(currentPos + len);
index 0aa2a651c63278332608969654a6653dddf64fbf..2c0615e15012422d02230c6dec9086659179e236 100644 (file)
@@ -213,7 +213,7 @@ void LineLayoutCache::Allocate(int length_) {
 }
 
 void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
-       PLATFORM_ASSERT(useCount == 0);
+//     PLATFORM_ASSERT(useCount == 0);
        int lengthForLevel = 0;
        if (level == llcCaret) {
                lengthForLevel = 1;
@@ -239,7 +239,7 @@ void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
 }
 
 void LineLayoutCache::Deallocate() {
-       PLATFORM_ASSERT(useCount == 0);
+//     PLATFORM_ASSERT(useCount == 0);
        for (int i = 0; i < length; i++)
                delete cache[i];
        delete []cache;
index f2b2b1b8c14dae39a95c47a56c08424b9b6627d0..f42348d4bf47972a51ef777770942176e5eb4295 100644 (file)
@@ -3186,12 +3186,7 @@ static void SetEventText(wxStyledTextEvent& evt, const char* text,
                          size_t length) {
     if(!text) return;
 
-    // The unicode conversion MUST have a null byte to terminate the
-    // string so move it into a buffer first and give it one.
-    wxMemoryBuffer buf(length+1);
-    buf.AppendData((void*)text, length);
-    buf.AppendByte(0);
-    evt.SetText(stc2wx(buf));
+    evt.SetText(stc2wx(text, length));
 }
 
 
index b99563feded2b5962193e8d9c7be766baeb3cfb9..2a9806a68a2adf03772aea3010017a41e22ce928 100644 (file)
@@ -854,12 +854,7 @@ static void SetEventText(wxStyledTextEvent& evt, const char* text,
                          size_t length) {
     if(!text) return;
 
-    // The unicode conversion MUST have a null byte to terminate the
-    // string so move it into a buffer first and give it one.
-    wxMemoryBuffer buf(length+1);
-    buf.AppendData((void*)text, length);
-    buf.AppendByte(0);
-    evt.SetText(stc2wx(buf));
+    evt.SetText(stc2wx(text, length));
 }