diff options
author | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2018-01-18 12:45:56 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2018-01-22 12:33:12 +0000 |
commit | 4db7fd064f747ef115da15f8800ae3b57d4e1ca1 (patch) | |
tree | c50f7243fdea3863fdd8dcd7a4f435d41f2061b1 /src/plugins/texteditor | |
parent | a4ff3423e9b6793c04f21f084e7b8139b4422714 (diff) | |
download | qt-creator-4db7fd064f747ef115da15f8800ae3b57d4e1ca1.tar.gz |
TextEditor: Avoid running hover handlers for same request
...in case the current run is not yet finished.
Change-Id: Id78db576ad8fad10af6b21c73e5b47b49d58d26b
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r-- | src/plugins/texteditor/texteditor.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 2e5aa9dd5f..a0cbd17699 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); |