Hi all!

I have a server application that has a class inherited from QTcpServer and another that is inherited from the QThread and has a QTcpSocket variable. Lets just say class_tcpServer and class_serverThread.

Qt Code:
  1. class class_tcpServer : QTcpServer {
  2. Q_OBJECT
  3. public:
  4. class_tcpServer();
  5. virtual ~class_tcpServer();
  6.  
  7. private:
  8. QTcpServer *tcpServer;
  9. class_tcpServer *ServerThread;
  10.  
  11. private slots:
  12. void wait_for_data();
  13. void free_slot(qint16);
  14. };
To copy to clipboard, switch view to plain text mode 

the implementation has a slot that activates in case of a connection from the server. the slot looks like this:

Qt Code:
  1. void class_tcpServer::wait_for_data()
  2. {
  3. cout << "New connection made" << endl;
  4.  
  5. while(tcpServer->hasPendingConnections()){ //This controls pending connections
  6.  
  7. for (i = 0 ; i < max_connections ; i++) //Max connections is the number of sql licenses
  8. {
  9. if (connections[i] == 0)
  10. {
  11. cout << "Found empty slot for new connection" << endl;
  12.  
  13. ServerThread[i] = new EFrwServer_thread();
  14.  
  15. connect(ServerThread[i], SIGNAL(free_connection_slot(qint16)), this, SLOT(free_slot(qint16)));
  16.  
  17.  
  18. ServerThread[i]->tcpSocket = tcpServer->nextPendingConnection();
  19.  
  20. ServerThread[i]->my_connection_number = i;
  21.  
  22. ServerThread[i]->start();
  23.  
  24. connections[i] = 1;
  25. i = max_connections;
  26. }
  27. }
  28. }
  29. }
To copy to clipboard, switch view to plain text mode 

The thread does a query and then send the query in a QByteArray via the tcpSocket. That works just fine. At the end of the thread a signal is emited which will activate the slot free_slot(qint16) which simply sets the license to not used.

Everything works fine but my problem is that the memory goes up and up (which is fine as I don't know how to delete it).

How do I delete the object? or can someone tell me other solution?

thanks