Commit Graph

4 Commits

Author SHA1 Message Date
Jarek Kobus
c17214c53f ClangClient: Receive done() signal only once
Before this change the done() signal was emitted 3 times
in a row. The reason was that first one was coming
synchonously from handleGotoDefinitionResult(), while
2 others were scheluded with queued connections.
So, the handler for done() signal was called 3 times.
The first invocation calls deleteLater() and clears
the pointer, while the object is still alive.
Before the request to delete later gets dispatched,
the 2 remaining done() emissions are dispatched,
so the handler is still called 2 times.

One possible solution would be to disconnect from
done() signal inside a handler. However, the done()
signal shouldn't be called many times, so this fix
ensures the done() is emitted only once.

This fixes the following prinouts:
"QCoreApplication::postEvent: Unexpected null receiver"
issued twice on every follow symbol interaction.

Amends 650bc260c6

Change-Id: I9b440a80386aca3462eda323e51a76696e53fa6b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-07-07 15:28:03 +00:00
Christian Kandeler
1a3f915586 ClangCodeModel: Fix following virtual functions
Amends 79b8e5397d.

Change-Id: I8c4e3c7cb8cb26d51cdf77c15891110c6b213d46
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-21 13:28:41 +00:00
Christian Kandeler
79b8e5397d ClangCodeModel: Prevent surprisingly late "follow symbol" reactions
It can happen under certain circumstances (high system load, overworked
clangd, ...) that "follow symbol" requests get replied to very late,
with the user having manually navigated to the target document in the
mean time or started doing something else entirely. In such a situation,
it would be disruptive if we were to jump to a symbol suddenly, stealing
the cursor from the unsuspecting user.
We now prevent this by aborting the "follow symbol" procedure if the
user does something else with the document.

Fixes: QTCREATORBUG-20878
Change-Id: Iea52db661e8ba634951b18654a94e4b90580f001
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-20 12:11:29 +00:00
Christian Kandeler
49bb40f19e ClangCodeModel: Move "follow symbol" into its own class
Change-Id: Ic64c7275debaa59c524f349fd38460f47f826ecd
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-08 09:48:17 +00:00