From e4f040147f3bdb310cbd0a88684825b740127d17 Mon Sep 17 00:00:00 2001 From: Robert Stefanic Date: Sat, 21 Aug 2021 14:03:44 -0400 Subject: [PATCH] SQLServer: Use m_client_id instead of client_id in callback In the DatabaseConnection constructor, there's a deferred_invoke callback that references the client_id. But depending on when the callback occurs, the reference of the client_id can change. This created a problem when connecting to SQLServer using the SQL utility because depending on when the callback was invoked, the client_id could change. m_client_id is set in the constructor and that reference will not change depending on when the callback is invoked. --- Userland/Services/SQLServer/DatabaseConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Services/SQLServer/DatabaseConnection.cpp b/Userland/Services/SQLServer/DatabaseConnection.cpp index e1ffebeec9..1a26d39129 100644 --- a/Userland/Services/SQLServer/DatabaseConnection.cpp +++ b/Userland/Services/SQLServer/DatabaseConnection.cpp @@ -41,7 +41,7 @@ DatabaseConnection::DatabaseConnection(String database_name, int client_id) deferred_invoke([&](Object&) { m_database = SQL::Database::construct(String::formatted("/home/anon/sql/{}.db", m_database_name)); m_accept_statements = true; - auto client_connection = ClientConnection::client_connection_for(client_id); + auto client_connection = ClientConnection::client_connection_for(m_client_id); if (client_connection) client_connection->async_connected(m_connection_id); else