summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorRobert Stefanic <rstefanic72@gmail.com>2021-08-21 14:03:44 -0400
committerAndreas Kling <kling@serenityos.org>2021-08-22 15:32:09 +0200
commite4f040147f3bdb310cbd0a88684825b740127d17 (patch)
tree6104936b101b7687484c2a274d9d3770e7554952 /Userland
parent9a4c1c019abbc876011e606fa680fe729036e2db (diff)
downloadserenity-e4f040147f3bdb310cbd0a88684825b740127d17.zip
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.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Services/SQLServer/DatabaseConnection.cpp2
1 files changed, 1 insertions, 1 deletions
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