From 02e34e5760d6ac350c33574736e14a2337ed2d03 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 15 Feb 2021 15:43:28 +0100 Subject: [PATCH] FancyLineEdit: Don't save empty item in history on destruction This would save an empty item in the history at shutdown, even if the user didn't do anything at all. Task-number: QTCREATORBUG-24762 Change-Id: I963e47e0d6e0ed17687ce8f887e3e240afb9e45f Reviewed-by: Orgad Shaneh Reviewed-by: Alessandro Portale --- src/libs/utils/fancylineedit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp index c02ef66daaf..b842104a08d 100644 --- a/src/libs/utils/fancylineedit.cpp +++ b/src/libs/utils/fancylineedit.cpp @@ -213,7 +213,8 @@ FancyLineEdit::~FancyLineEdit() // the QueuedConnection don't have enough time to call slot callback // because edit widget and all of its connections are destroyed before // QCoreApplicationPrivate::sendPostedEvents dispatch our queued signal. - d->m_historyCompleter->addEntry(text()); + if (!text().isEmpty()) + d->m_historyCompleter->addEntry(text()); } }