mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
LanguageServers/Cpp: Fix nullptr dereference in ~LanguageClient
The WeakPtr to the ServerConnection is nullified if the server crashes. Closes #5570.
This commit is contained in:
parent
0e881bc5d7
commit
05c48cc8d8
Notes:
sideshowbarker
2024-07-18 21:46:32 +09:00
Author: https://github.com/itamar8910 Commit: https://github.com/SerenityOS/serenity/commit/05c48cc8d8d Pull-request: https://github.com/SerenityOS/serenity/pull/5592 Issue: https://github.com/SerenityOS/serenity/issues/5570
|
@ -112,7 +112,10 @@ public:
|
|||
|
||||
virtual ~LanguageClient()
|
||||
{
|
||||
m_server_connection->detach();
|
||||
// m_server_connection is nullified if the server crashes
|
||||
if (m_server_connection)
|
||||
m_server_connection->detach();
|
||||
|
||||
VERIFY(m_previous_client.ptr() != this);
|
||||
if (m_previous_client)
|
||||
m_server_connection->attach(*m_previous_client);
|
||||
|
|
Loading…
Reference in a new issue