From 4db7fd064f747ef115da15f8800ae3b57d4e1ca1 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 18 Jan 2018 12:45:56 +0100 Subject: [PATCH] TextEditor: Avoid running hover handlers for same request ...in case the current run is not yet finished. Change-Id: Id78db576ad8fad10af6b21c73e5b47b49d58d26b Reviewed-by: Ivan Donchevskii --- src/plugins/texteditor/texteditor.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 2e5aa9dd5f6..a0cbd176999 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -313,6 +313,9 @@ public: return; } + if (isCheckRunning(documentRevision, position)) + return; + // Cancel currently running checks for (BaseHoverHandler *handler : m_handlers) handler->abort(); @@ -331,6 +334,13 @@ public: checkNext(); } + bool isCheckRunning(int documentRevision, int position) const + { + return m_currentHandlerIndex <= m_handlers.size() + && m_documentRevision == documentRevision + && m_position == position; + } + void checkNext() { QTC_ASSERT(m_currentHandlerIndex < m_handlers.size(), return);