[Server] Drop the redundant database interface cast

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.
This commit is contained in:
Lukas Brübach 2026-11-09 16:56:26 +01:00
parent 3b379618c3
commit 9677c953a0

View file

@ -195,8 +195,7 @@ static const int MAX_TCP_MESSAGE_SIZE = 1500000;
AbstractServerSocketInterface::AbstractServerSocketInterface(Servatrice *_server, AbstractServerSocketInterface::AbstractServerSocketInterface(Servatrice *_server,
Servatrice_DatabaseInterface *_databaseInterface, Servatrice_DatabaseInterface *_databaseInterface,
QObject *parent) QObject *parent)
: Server_ProtocolHandler(_server, _databaseInterface, parent), servatrice(_server), : Server_ProtocolHandler(_server, _databaseInterface, parent), servatrice(_server), sqlInterface(_databaseInterface)
sqlInterface(reinterpret_cast<Servatrice_DatabaseInterface *>(databaseInterface))
{ {
// Never call flushOutputQueue directly from outputQueueChanged. In case of a socket error, // 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 // it could lead to this object being destroyed while another function is still on the call stack. -> mutex