Browse Source

Fixed memory leak in HTTP server

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
e21c28e9d2
  1. 3
      src/httpserver.cpp
  2. 3
      src/httpserver.h

3
src/httpserver.cpp

@ -46,13 +46,14 @@ HttpServer::HttpServer(bittorrent *BTSession, int msec, QObject* parent) : QTcpS
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), manager, SLOT(addedTorrent(QTorrentHandle&))); connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), manager, SLOT(addedTorrent(QTorrentHandle&)));
connect(BTSession, SIGNAL(deletedTorrent(QString)), manager, SLOT(deletedTorrent(QString))); connect(BTSession, SIGNAL(deletedTorrent(QString)), manager, SLOT(deletedTorrent(QString)));
//set timer //set timer
QTimer *timer = new QTimer(this); timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(onTimer())); connect(timer, SIGNAL(timeout()), this, SLOT(onTimer()));
timer->start(msec); timer->start(msec);
} }
HttpServer::~HttpServer() HttpServer::~HttpServer()
{ {
delete timer;
delete manager; delete manager;
} }

3
src/httpserver.h

@ -26,7 +26,7 @@
#include <QByteArray> #include <QByteArray>
class bittorrent; class bittorrent;
class QTimer;
class EventManager; class EventManager;
class HttpServer : public QTcpServer class HttpServer : public QTcpServer
@ -37,6 +37,7 @@ class HttpServer : public QTcpServer
QByteArray base64; QByteArray base64;
bittorrent *BTSession; bittorrent *BTSession;
EventManager *manager; EventManager *manager;
QTimer *timer;
public: public:
HttpServer(bittorrent *BTSession, int msec, QObject* parent = 0); HttpServer(bittorrent *BTSession, int msec, QObject* parent = 0);

Loading…
Cancel
Save