This should fix the use after free rare issue: C++ destroys class members in reverse declaration order. mProcess was declared before mHandlers. So during destruction, mHandlers was freed first, then mProcess destructor ran and joined the async read threads but by then the threads were already accessing freed memory.

This commit is contained in:
Martín Lucas Golini
2026-06-11 20:47:27 -03:00
parent 10588e3eb4
commit b91b922ac8
2 changed files with 1 additions and 5 deletions

View File

@@ -2119,7 +2119,6 @@ void LSPClientServer::processRequest( const json& msg ) {
}
void LSPClientServer::readStdOut( const char* bytes, size_t n ) {
BoolScopedOp op( mReadingStdOut );
if ( mEnded )
return;
mReceive.append( bytes, n );
@@ -2261,7 +2260,6 @@ void LSPClientServer::notifyServerError() {
}
void LSPClientServer::readStdErr( const char* bytes, size_t n ) {
BoolScopedOp op( mReadingStdErr );
if ( mEnded )
return;