fix a timer leak, line width in PacketList

This commit is contained in:
Stephen Birarda 2015-09-29 16:35:24 -04:00
parent 2976520061
commit f4bc3f8e38
2 changed files with 5 additions and 3 deletions

View file

@ -49,7 +49,8 @@ void ThreadedAssignment::setFinished(bool isFinished) {
}
if (_statsTimer) {
_statsTimer->stop();
_statsTimer->deleteLater();
_statsTimer = nullptr;
}
// call our virtual aboutToFinish method - this gives the ThreadedAssignment subclass a chance to cleanup
@ -105,7 +106,7 @@ void ThreadedAssignment::sendStatsPacket() {
void ThreadedAssignment::startSendingStats() {
// send the stats packet every 1s
if (!_statsTimer) {
_statsTimer = new QTimer();
_statsTimer = new QTimer;
connect(_statsTimer, &QTimer::timeout, this, &ThreadedAssignment::sendStatsPacket);
}

View file

@ -28,7 +28,8 @@ class Packet;
class PacketList : public QIODevice {
Q_OBJECT
public:
static std::unique_ptr<PacketList> create(PacketType packetType, QByteArray extendedHeader = QByteArray(), bool isReliable = false, bool isOrdered = false);
static std::unique_ptr<PacketList> create(PacketType packetType, QByteArray extendedHeader = QByteArray(),
bool isReliable = false, bool isOrdered = false);
static std::unique_ptr<PacketList> fromReceivedPackets(std::list<std::unique_ptr<Packet>>&& packets);
bool isReliable() const { return _isReliable; }