[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.
This commit is contained in:
BruebachL 2026-11-10 12:16:20 +01:00 • committed by GitHub
parent 505c3b62dc
commit 90b3013db6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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