Stop leaking PropagateDownloadEncrypted objects

We give them a parent to make sure they will be destroyed when the jobs
which created them are destroyed themselves.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
Kevin Ottens 2020-06-24 17:58:52 +02:00
parent 01d44dd3a1
commit 2abc3ce2f5
3 changed files with 7 additions and 5 deletions

View File

@ -344,7 +344,7 @@ void PropagateDownloadFile::start()
qCDebug(lcPropagateDownload) << _item->_file << propagator()->_activeJobList.count();
if (propagator()->account()->capabilities().clientSideEncryptionAvailable()) {
_downloadEncryptedHelper = new PropagateDownloadEncrypted(propagator(), _item);
_downloadEncryptedHelper = new PropagateDownloadEncrypted(propagator(), _item, this);
connect(_downloadEncryptedHelper, &PropagateDownloadEncrypted::folderStatusNotEncrypted, [this] {
startAfterIsEncryptedIsChecked();
});

View File

@ -6,9 +6,11 @@ Q_LOGGING_CATEGORY(lcPropagateDownloadEncrypted, "nextcloud.sync.propagator.down
namespace OCC {
PropagateDownloadEncrypted::PropagateDownloadEncrypted(OwncloudPropagator *propagator, SyncFileItemPtr item) :
_propagator(propagator), _item(item), _info(_item->_file)
PropagateDownloadEncrypted::PropagateDownloadEncrypted(OwncloudPropagator *propagator, SyncFileItemPtr item, QObject *parent)
: QObject(parent)
, _propagator(propagator)
, _item(item)
, _info(_item->_file)
{
}

View File

@ -15,7 +15,7 @@ namespace OCC {
class PropagateDownloadEncrypted : public QObject {
Q_OBJECT
public:
PropagateDownloadEncrypted(OwncloudPropagator *propagator, SyncFileItemPtr item);
PropagateDownloadEncrypted(OwncloudPropagator *propagator, SyncFileItemPtr item, QObject *parent = nullptr);
void start();
void checkFolderId(const QStringList &list);
bool decryptFile(QFile& tmpFile);