[Pkg-owncloud-commits] [owncloud-client] 82/164: Discovery: Free some memory on VIO dir close (#2902)
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sun Mar 22 11:56:56 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 7595c7e697e465bbdd2e7212b8f565db49d6f451
Author: Markus Goetz <markus at woboq.com>
Date: Mon Mar 2 14:09:01 2015 +0100
Discovery: Free some memory on VIO dir close (#2902)
---
src/libsync/discoveryphase.cpp | 13 ++++++++++++-
src/libsync/discoveryphase.h | 12 ++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp
index 91b5bb5..9060a2b 100644
--- a/src/libsync/discoveryphase.cpp
+++ b/src/libsync/discoveryphase.cpp
@@ -309,6 +309,15 @@ void DiscoveryMainThread::setupHooks(DiscoveryJob *discoveryJob, const QString &
connect(discoveryJob, SIGNAL(doOpendirSignal(QString,DiscoveryDirectoryResult*)),
this, SLOT(doOpendirSlot(QString,DiscoveryDirectoryResult*)),
Qt::QueuedConnection);
+ connect(discoveryJob, SIGNAL(doClosedirSignal(QString)),
+ this, SLOT(doClosedirSlot(QString)),
+ Qt::QueuedConnection);
+}
+
+void DiscoveryMainThread::doClosedirSlot(QString path)
+{
+ //qDebug() << Q_FUNC_INFO << "Invalidating" << path;
+ deleteCacheEntry(path);
}
// Coming from owncloud_opendir -> DiscoveryJob::vio_opendir_hook -> doOpendirSignal
@@ -461,9 +470,11 @@ void DiscoveryJob::remote_vio_closedir_hook (csync_vio_handle_t *dhandle, void
{
DiscoveryJob *discoveryJob = static_cast<DiscoveryJob*>(userdata);
if (discoveryJob) {
- qDebug() << Q_FUNC_INFO << discoveryJob;
DiscoveryDirectoryResult *directoryResult = static_cast<DiscoveryDirectoryResult*> (dhandle);
+ QString path = directoryResult->path;
+ qDebug() << Q_FUNC_INFO << discoveryJob << path;
delete directoryResult; // just deletes the struct and the iterator, the data itself is owned by the SyncEngine/DiscoveryMainThread
+ emit discoveryJob->doClosedirSignal(path);
}
}
diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h
index 207883c..a4ce848 100644
--- a/src/libsync/discoveryphase.h
+++ b/src/libsync/discoveryphase.h
@@ -87,7 +87,16 @@ public:
DiscoveryMainThread(AccountPtr account) : QObject(), _account(account), _currentDiscoveryDirectoryResult(0) {
}
+ void deleteCacheEntry(QString path) {
+ //qDebug() << path << _directoryContents.value(path).count();
+ foreach (csync_vio_file_stat_t* stat, _directoryContents.value(path)) {
+ csync_vio_file_stat_destroy(stat);
+ }
+ _directoryContents.remove(path);
+ }
+
~DiscoveryMainThread() {
+ // Delete the _contents_ of the list-map explicitly:
foreach (const QLinkedList<csync_vio_file_stat_t*> & list, _directoryContents) {
foreach (csync_vio_file_stat_t* stat, list) {
csync_vio_file_stat_destroy(stat);
@@ -100,6 +109,7 @@ public:
public slots:
// From DiscoveryJob:
void doOpendirSlot(QString url, DiscoveryDirectoryResult* );
+ void doClosedirSlot(QString path);
// From Job:
void singleDirectoryJobResultSlot(QLinkedList<csync_vio_file_stat_t*>);
@@ -164,6 +174,8 @@ signals:
// After the discovery job has been woken up again (_vioWaitCondition)
void doOpendirSignal(QString url, DiscoveryDirectoryResult*);
+ // to tell the main thread to invalidate its directory data
+ void doClosedirSignal(QString path);
};
}
--
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