From 90b3013db6ef67f5d01ddf5d7c1722a11f76a1a1 Mon Sep 17 00:00:00 2001 From: BruebachL <44814898+BruebachL@users.noreply.github.com> Date: Tue, 10 Nov 2026 12:16:20 +0100 Subject: [PATCH] [Server] Drop the redundant database interface cast (#7826) The socket-handler constructor already takes Servatrice_DatabaseInterface *, so the reinterpret_cast from the base member to the same type adds nothing and would silently hide a wrong implementation if a different database type were ever injected. Initialize sqlInterface from the typed constructor parameter instead. --- servatrice/src/serversocketinterface.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/servatrice/src/serversocketinterface.cpp b/servatrice/src/serversocketinterface.cpp index 49cc053b3..88fb8e0cc 100644 --- a/servatrice/src/serversocketinterface.cpp +++ b/servatrice/src/serversocketinterface.cpp @@ -195,8 +195,7 @@ static const int MAX_TCP_MESSAGE_SIZE = 1500000; AbstractServerSocketInterface::AbstractServerSocketInterface(Servatrice *_server, Servatrice_DatabaseInterface *_databaseInterface, QObject *parent) - : Server_ProtocolHandler(_server, _databaseInterface, parent), servatrice(_server), - sqlInterface(reinterpret_cast(databaseInterface)) + : Server_ProtocolHandler(_server, _databaseInterface, parent), servatrice(_server), sqlInterface(_databaseInterface) { // Never call flushOutputQueue directly from outputQueueChanged. In case of a socket error, // it could lead to this object being destroyed while another function is still on the call stack. -> mutex