[Pkg-owncloud-commits] [owncloud-client] 75/175: Make TransmissionChecksumValidator child of the job for auto delete.

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Aug 8 10:36:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 5b5a636cc172d3406a06be2da2533dd5df9edc73
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Wed May 20 16:54:04 2015 +0200

    Make TransmissionChecksumValidator child of the job for auto delete.
    
    That way no explicit memory management is needed as the allocation
    is freed when the job (parent) is deleted automatically.
---
 src/libsync/propagatedownload.cpp | 11 ++++-------
 src/libsync/propagatedownload.h   |  4 ----
 src/libsync/propagateupload.cpp   |  8 +++-----
 src/libsync/propagateupload.h     |  3 ---
 4 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp
index fc943d0..aa30a3a 100644
--- a/src/libsync/propagatedownload.cpp
+++ b/src/libsync/propagatedownload.cpp
@@ -489,16 +489,15 @@ void PropagateDownloadFileQNAM::slotGetFinished()
     // do whatever is needed to add a checksum to the http upload request.
     // in any case, the validator will emit signal startUpload to let the flow
     // continue in slotStartUpload here.
-    _validator = new TransmissionChecksumValidator( _tmpFile.fileName() );
-    connect(_validator, SIGNAL(validated()), this, SLOT(downloadFinished()));
-    connect(_validator, SIGNAL(validationFailed(QString)), this, SLOT(slotChecksumFail(QString)));
-    _validator->downloadValidation(job->reply()->rawHeader(checkSumHeaderC));
+    TransmissionChecksumValidator *validator = new TransmissionChecksumValidator(_tmpFile.fileName(), this);
+    connect(validator, SIGNAL(validated()), this, SLOT(downloadFinished()));
+    connect(validator, SIGNAL(validationFailed(QString)), this, SLOT(slotChecksumFail(QString)));
+    validator->downloadValidation(job->reply()->rawHeader(checkSumHeaderC));
 
 }
 
 void PropagateDownloadFileQNAM::slotChecksumFail( const QString& errMsg )
 {
-    _validator->deleteLater();
     _tmpFile.remove();
     _propagator->_anotherSyncNeeded = true;
     done(SyncFileItem::SoftError, errMsg ); // tr("The file downloaded with a broken checksum, will be redownloaded."));
@@ -527,8 +526,6 @@ QString makeConflictFileName(const QString &fn, const QDateTime &dt)
 
 void PropagateDownloadFileQNAM::downloadFinished()
 {
-    _validator->deleteLater();
-
     QString fn = _propagator->getFilePath(_item._file);
 
     // In case of file name clash, report an error
diff --git a/src/libsync/propagatedownload.h b/src/libsync/propagatedownload.h
index 7ec9bd3..b2cf18c 100644
--- a/src/libsync/propagatedownload.h
+++ b/src/libsync/propagatedownload.h
@@ -21,8 +21,6 @@
 
 namespace OCC {
 
-class TransmissionChecksumValidator;
-
 class GETFileJob : public AbstractNetworkJob {
     Q_OBJECT
     QFile* _device;
@@ -119,8 +117,6 @@ private:
     // Utility::StopWatch _stopWatch;
     QPointer<GETFileJob> _job;
     QFile _tmpFile;
-    TransmissionChecksumValidator *_validator;
-
 };
 
 }
diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp
index 6707b17..f602132 100644
--- a/src/libsync/propagateupload.cpp
+++ b/src/libsync/propagateupload.cpp
@@ -211,15 +211,13 @@ void PropagateUploadFileQNAM::start()
     // do whatever is needed to add a checksum to the http upload request.
     // in any case, the validator will emit signal startUpload to let the flow
     // continue in slotStartUpload here.
-    _validator = new TransmissionChecksumValidator(filePath);
-    connect(_validator, SIGNAL(validated()), this, SLOT(slotStartUpload()));
-    _validator->uploadValidation( &_item );
+    TransmissionChecksumValidator *validator = new TransmissionChecksumValidator(filePath, this);
+    connect(validator, SIGNAL(validated()), this, SLOT(slotStartUpload()));
+    validator->uploadValidation( &_item );
 }
 
 void PropagateUploadFileQNAM::slotStartUpload()
 {
-    _validator->deleteLater();
-
     const QString fullFilePath(_propagator->getFilePath(_item._file));
 
     if (!FileSystem::fileExists(fullFilePath)) {
diff --git a/src/libsync/propagateupload.h b/src/libsync/propagateupload.h
index 7b5e11f..3746ff4 100644
--- a/src/libsync/propagateupload.h
+++ b/src/libsync/propagateupload.h
@@ -23,7 +23,6 @@
 
 namespace OCC {
 class BandwidthManager;
-class TransmissionChecksumValidator;
 
 class UploadDevice : public QIODevice {
     Q_OBJECT
@@ -172,8 +171,6 @@ private:
     // measure the performance of checksum calc and upload
     Utility::StopWatch _stopWatch;
 
-    TransmissionChecksumValidator *_validator;
-
 public:
     PropagateUploadFileQNAM(OwncloudPropagator* propagator,const SyncFileItem& item)
         : PropagateItemJob(propagator, item), _startChunk(0), _currentChunk(0), _chunkCount(0), _transferId(0), _finished(false) {}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list