Browse Source

Avoided listener callbacks during TextEditor destructor.

tags/2021-05-28
jules 11 years ago
parent
commit
fc683ee72a
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      modules/juce_gui_basics/widgets/juce_TextEditor.cpp

+ 8
- 3
modules/juce_gui_basics/widgets/juce_TextEditor.cpp View File

@@ -966,7 +966,12 @@ TextEditor::~TextEditor()
textValue.removeListener (textHolder);
textValue.referTo (Value());
clearInternal (0);
for (int i = 0; i < sections.size(); ++i)
delete sections.getUnchecked(i);
sections.clear();
viewport = nullptr;
textHolder = nullptr;
}
@@ -1183,7 +1188,7 @@ void TextEditor::setScrollBarThickness (const int newThicknessPixels)
//==============================================================================
void TextEditor::clear()
{
clearInternal (0);
clearInternal (nullptr);
updateTextHolderSize();
undoManager.clearUndoHistory();
}
@@ -1200,7 +1205,7 @@ void TextEditor::setText (const String& newText,
int oldCursorPos = caretPosition;
const bool cursorWasAtEnd = oldCursorPos >= getTotalNumChars();
clearInternal (0);
clearInternal (nullptr);
insert (newText, 0, currentFont, findColour (textColourId), 0, caretPosition);
// if you're adding text with line-feeds to a single-line text editor, it


Loading…
Cancel
Save