[Pkg-owncloud-commits] [owncloud-client] 73/83: Make sure that OwncloudPropgator::finished is only emit once
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat May 31 11:31:45 UTC 2014
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 0151682a53f76c3ce90d6135b6eadf20ffafa538
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Thu May 29 12:15:13 2014 +0200
Make sure that OwncloudPropgator::finished is only emit once
When we abort, each job currently running may result in a call to finished().
It used to cause a crash because we would unlock the _syncMutex twice
Fixes #1793
---
src/mirall/owncloudpropagator.cpp | 2 +-
src/mirall/owncloudpropagator.h | 13 ++++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp
index b212c4c..f683152 100644
--- a/src/mirall/owncloudpropagator.cpp
+++ b/src/mirall/owncloudpropagator.cpp
@@ -251,7 +251,7 @@ void OwncloudPropagator::start(const SyncFileItemVector& _syncedItems)
connect(_rootJob.data(), SIGNAL(completed(SyncFileItem)), this, SIGNAL(completed(SyncFileItem)));
connect(_rootJob.data(), SIGNAL(progress(SyncFileItem,quint64)), this, SIGNAL(progress(SyncFileItem,quint64)));
- connect(_rootJob.data(), SIGNAL(finished(SyncFileItem::Status)), this, SIGNAL(finished()));
+ connect(_rootJob.data(), SIGNAL(finished(SyncFileItem::Status)), this, SLOT(emitFinished()));
qDebug() << (useLegacyJobs() ? "Using legacy libneon/HTTP sequential code path" : "Using QNAM/HTTP parallel code path");
diff --git a/src/mirall/owncloudpropagator.h b/src/mirall/owncloudpropagator.h
index bc95f42..aeede4a 100644
--- a/src/mirall/owncloudpropagator.h
+++ b/src/mirall/owncloudpropagator.h
@@ -187,6 +187,7 @@ public:
const QString _remoteFolder; // folder. (same as remoteDir but without remote.php/webdav)
SyncJournalDb * const _journal;
+ bool _finishedEmited; // used to ensure that finished is only emit once
public:
OwncloudPropagator(ne_session_s *session, const QString &localDir, const QString &remoteDir, const QString &remoteFolder,
@@ -197,6 +198,7 @@ public:
, _remoteDir((remoteDir.endsWith(QChar('/'))) ? remoteDir : remoteDir+'/' )
, _remoteFolder((remoteFolder.endsWith(QChar('/'))) ? remoteFolder : remoteFolder+'/' )
, _journal(progressDb)
+ , _finishedEmited(false)
, _activeJobs(0)
{ }
@@ -218,12 +220,21 @@ public:
if (_rootJob) {
_rootJob->abort();
}
- emit finished();
+ emitFinished();
}
// timeout in seconds
static int httpTimeout();
+private slots:
+
+ /** Emit the finished signal and make sure it is only emit once */
+ void emitFinished() {
+ if (!_finishedEmited)
+ emit finished();
+ _finishedEmited = true;
+ }
+
signals:
void completed(const SyncFileItem &);
void progress(const SyncFileItem&, quint64 bytes);
--
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