qtlanguageserver: avoid potential double-free or use-after-free
RequestBatchHandler::processMessages() incremented a pending-request
counter and deleted itself once the counter reached zero. A handler that
resolves syncronously could hit delete to fire before dispatching had
actually finished. This could either lead to double-free or
use-after-free depending on the size of the batch.
Add a "dispatch done" guard so the object is only deleted once, and
only after the dispatch loop has fully completed.
Pick-to: 6.12
Fixes: QTBUG-148484
Change-Id: I2a4ffa488619feb84595d74bf76be408fc32dd18
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>