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>
This commit is contained in:
Nikolai Kosjar
2018-01-18 12:45:56 +01:00
parent a4ff3423e9
commit 4db7fd064f

View File

@@ -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);