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>
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>