diff --git a/autotests/kerfuffle/jobstest.cpp b/autotests/kerfuffle/jobstest.cpp --- a/autotests/kerfuffle/jobstest.cpp +++ b/autotests/kerfuffle/jobstest.cpp @@ -103,7 +103,7 @@ { m_entries.clear(); - ListJob *listJob = new ListJob(iface, this); + ListJob *listJob = new ListJob(iface); connect(listJob, &Job::newEntry, this, &JobsTest::slotNewEntry); @@ -189,7 +189,7 @@ JSONArchiveInterface *iface = createArchiveInterface(jsonArchive); QVERIFY(iface); - ListJob *listJob = new ListJob(iface, this); + ListJob *listJob = new ListJob(iface); listJob->setAutoDelete(false); startAndWaitForResult(listJob); @@ -217,7 +217,7 @@ void JobsTest::testExtractJobAccessors() { JSONArchiveInterface *iface = createArchiveInterface(QFINDTESTDATA("data/archive001.json")); - ExtractJob *job = new ExtractJob(QVariantList(), QStringLiteral("/tmp/some-dir"), ExtractionOptions(), iface, this); + ExtractJob *job = new ExtractJob(QVariantList(), QStringLiteral("/tmp/some-dir"), ExtractionOptions(), iface); ExtractionOptions defaultOptions; defaultOptions[QStringLiteral("PreservePaths")] = false; @@ -229,13 +229,14 @@ QCOMPARE(job->destinationDirectory(), QLatin1String("/tmp/some-dir")); QCOMPARE(job->extractionOptions(), defaultOptions); + delete job; ExtractionOptions options; options[QStringLiteral("PreservePaths")] = true; options[QStringLiteral("foo")] = QLatin1String("bar"); options[QStringLiteral("pi")] = 3.14f; - job = new ExtractJob(QVariantList(), QStringLiteral("/root"), options, iface, this); + job = new ExtractJob(QVariantList(), QStringLiteral("/root"), options, iface); QCOMPARE(job->destinationDirectory(), QLatin1String("/root")); QCOMPARE(job->extractionOptions(), options); @@ -245,6 +246,7 @@ QCOMPARE(job->destinationDirectory(), QLatin1String("/root")); QCOMPARE(job->extractionOptions(), options); + delete job; } void JobsTest::testRemoveEntries_data() @@ -283,7 +285,7 @@ } } - DeleteJob *deleteJob = new DeleteJob(entriesToDelete, iface, this); + DeleteJob *deleteJob = new DeleteJob(entriesToDelete, iface); startAndWaitForResult(deleteJob); auto remainingEntries = listEntries(iface); @@ -327,7 +329,7 @@ QCOMPARE(currentEntries.size(), originalEntries.size()); QFETCH(QStringList, entriesToAdd); - AddJob *addJob = new AddJob(entriesToAdd, CompressionOptions(), iface, this); + AddJob *addJob = new AddJob(entriesToAdd, CompressionOptions(), iface); startAndWaitForResult(addJob); currentEntries = listEntries(iface); diff --git a/kerfuffle/archive_kerfuffle.cpp b/kerfuffle/archive_kerfuffle.cpp --- a/kerfuffle/archive_kerfuffle.cpp +++ b/kerfuffle/archive_kerfuffle.cpp @@ -177,7 +177,7 @@ qCDebug(ARK) << "Going to add comment:" << comment; Q_ASSERT(!isReadOnly()); - CommentJob *job = new CommentJob(comment, static_cast(m_iface), this); + CommentJob *job = new CommentJob(comment, static_cast(m_iface)); return job; } @@ -189,7 +189,7 @@ qCDebug(ARK) << "Going to test archive"; - TestJob *job = new TestJob(m_iface, this); + TestJob *job = new TestJob(m_iface); return job; } @@ -298,7 +298,7 @@ qCDebug(ARK) << "Going to list files"; - ListJob *job = new ListJob(m_iface, this); + ListJob *job = new ListJob(m_iface); //if this job has not been listed before, we grab the opportunity to //collect some information about the archive @@ -319,7 +319,7 @@ if (m_iface->isReadOnly()) { return 0; } - DeleteJob *newJob = new DeleteJob(files, static_cast(m_iface), this); + DeleteJob *newJob = new DeleteJob(files, static_cast(m_iface)); return newJob; } @@ -337,7 +337,8 @@ qCDebug(ARK) << "Going to add files" << files << "with options" << newOptions; Q_ASSERT(!m_iface->isReadOnly()); - AddJob *newJob = new AddJob(files, newOptions, static_cast(m_iface), this); + + AddJob *newJob = new AddJob(files, newOptions, static_cast(m_iface)); connect(newJob, &AddJob::result, this, &Archive::onAddFinished); return newJob; } @@ -353,7 +354,7 @@ newOptions[QStringLiteral( "PasswordProtectedHint" )] = true; } - ExtractJob *newJob = new ExtractJob(files, destinationDir, newOptions, m_iface, this); + ExtractJob *newJob = new ExtractJob(files, destinationDir, newOptions, m_iface); return newJob; } diff --git a/kerfuffle/jobs.h b/kerfuffle/jobs.h --- a/kerfuffle/jobs.h +++ b/kerfuffle/jobs.h @@ -52,7 +52,7 @@ bool isRunning() const; protected: - Job(ReadOnlyArchiveInterface *interface, QObject *parent = 0); + Job(ReadOnlyArchiveInterface *interface); virtual ~Job(); virtual bool doKill(); virtual void emitResult(); @@ -95,7 +95,7 @@ Q_OBJECT public: - explicit ListJob(ReadOnlyArchiveInterface *interface, QObject *parent = 0); + explicit ListJob(ReadOnlyArchiveInterface *interface); qlonglong extractedFilesSize() const; bool isPasswordProtected() const; @@ -123,7 +123,7 @@ Q_OBJECT public: - ExtractJob(const QVariantList& files, const QString& destinationDir, const ExtractionOptions& options, ReadOnlyArchiveInterface *interface, QObject *parent = 0); + ExtractJob(const QVariantList& files, const QString& destinationDir, const ExtractionOptions& options, ReadOnlyArchiveInterface *interface); QString destinationDirectory() const; ExtractionOptions extractionOptions() const; @@ -145,7 +145,7 @@ Q_OBJECT public: - AddJob(const QStringList& files, const CompressionOptions& options, ReadWriteArchiveInterface *interface, QObject *parent = 0); + AddJob(const QStringList& files, const CompressionOptions& options, ReadWriteArchiveInterface *interface); public slots: virtual void doWork() Q_DECL_OVERRIDE; @@ -164,7 +164,7 @@ Q_OBJECT public: - DeleteJob(const QVariantList& files, ReadWriteArchiveInterface *interface, QObject *parent = 0); + DeleteJob(const QVariantList& files, ReadWriteArchiveInterface *interface); public slots: virtual void doWork() Q_DECL_OVERRIDE; @@ -178,7 +178,7 @@ Q_OBJECT public: - CommentJob(const QString& comment, ReadWriteArchiveInterface *interface, QObject *parent = 0); + CommentJob(const QString& comment, ReadWriteArchiveInterface *interface); public slots: virtual void doWork() Q_DECL_OVERRIDE; @@ -192,7 +192,7 @@ Q_OBJECT public: - TestJob(ReadOnlyArchiveInterface *interface, QObject *parent = 0); + TestJob(ReadOnlyArchiveInterface *interface); bool testSucceeded(); public slots: diff --git a/kerfuffle/jobs.cpp b/kerfuffle/jobs.cpp --- a/kerfuffle/jobs.cpp +++ b/kerfuffle/jobs.cpp @@ -70,8 +70,8 @@ #endif } -Job::Job(ReadOnlyArchiveInterface *interface, QObject *parent) - : KJob(parent) +Job::Job(ReadOnlyArchiveInterface *interface) + : KJob() , m_archiveInterface(interface) , m_isRunning(false) , d(new Private(this)) @@ -192,8 +192,8 @@ return ret; } -ListJob::ListJob(ReadOnlyArchiveInterface *interface, QObject *parent) - : Job(interface, parent) +ListJob::ListJob(ReadOnlyArchiveInterface *interface) + : Job(interface) , m_isSingleFolderArchive(true) , m_isPasswordProtected(false) , m_extractedFilesSize(0) @@ -271,8 +271,8 @@ return m_subfolderName; } -ExtractJob::ExtractJob(const QVariantList& files, const QString& destinationDir, const ExtractionOptions& options, ReadOnlyArchiveInterface *interface, QObject *parent) - : Job(interface, parent) +ExtractJob::ExtractJob(const QVariantList& files, const QString& destinationDir, const ExtractionOptions& options, ReadOnlyArchiveInterface *interface) + : Job(interface) , m_files(files) , m_destinationDir(destinationDir) , m_options(options) @@ -336,8 +336,8 @@ return m_options; } -AddJob::AddJob(const QStringList& files, const CompressionOptions& options , ReadWriteArchiveInterface *interface, QObject *parent) - : Job(interface, parent) +AddJob::AddJob(const QStringList& files, const CompressionOptions& options , ReadWriteArchiveInterface *interface) + : Job(interface) , m_files(files) , m_options(options) { @@ -394,8 +394,8 @@ Job::onFinished(result); } -DeleteJob::DeleteJob(const QVariantList& files, ReadWriteArchiveInterface *interface, QObject *parent) - : Job(interface, parent) +DeleteJob::DeleteJob(const QVariantList& files, ReadWriteArchiveInterface *interface) + : Job(interface) , m_files(files) { } @@ -417,8 +417,8 @@ } } -CommentJob::CommentJob(const QString& comment, ReadWriteArchiveInterface *interface, QObject *parent) - : Job(interface, parent) +CommentJob::CommentJob(const QString& comment, ReadWriteArchiveInterface *interface) + : Job(interface) , m_comment(comment) { } @@ -440,8 +440,8 @@ } } -TestJob::TestJob(ReadOnlyArchiveInterface *interface, QObject *parent) - : Job(interface, parent) +TestJob::TestJob(ReadOnlyArchiveInterface *interface) + : Job(interface) { m_testSuccess = false; }