diff --git a/src/editor/dtextedit.cpp b/src/editor/dtextedit.cpp index 6a70ba0c..6c65701c 100644 --- a/src/editor/dtextedit.cpp +++ b/src/editor/dtextedit.cpp @@ -68,7 +68,7 @@ TextEdit::TextEdit(QWidget *parent) { setUndoRedoEnabled(false); //撤销重做栈 - m_pUndoStack = new QUndoStack(this); + m_pUndoStack = new QUndoStack(); m_nLines = 0; m_nBookMarkHoverLine = -1; @@ -172,6 +172,10 @@ TextEdit::~TextEdit() delete m_rightMenu; m_rightMenu = nullptr; } + + if (m_pUndoStack != nullptr) { + m_pUndoStack->deleteLater(); + } } void TextEdit::insertTextEx(QTextCursor cursor, QString text)