┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/statusbar/mountpointobserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/statusbar/mountpointobserver.cpp')
-rw-r--r--src/statusbar/mountpointobserver.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/statusbar/mountpointobserver.cpp b/src/statusbar/mountpointobserver.cpp
index 67d341b3d..231ea72e7 100644
--- a/src/statusbar/mountpointobserver.cpp
+++ b/src/statusbar/mountpointobserver.cpp
@@ -8,8 +8,6 @@
#include "mountpointobservercache.h"
-#include <KIO/FileSystemFreeSpaceJob>
-
MountPointObserver::MountPointObserver(const QUrl &url, QObject *parent)
: QObject(parent)
, m_url(url)
@@ -17,6 +15,13 @@ MountPointObserver::MountPointObserver(const QUrl &url, QObject *parent)
{
}
+MountPointObserver::~MountPointObserver()
+{
+ if (m_pendingJob) {
+ m_pendingJob->kill(KJob::Quietly);
+ }
+}
+
MountPointObserver *MountPointObserver::observerForUrl(const QUrl &url)
{
MountPointObserver *observer = MountPointObserverCache::instance()->observerForUrl(url);
@@ -27,10 +32,13 @@ void MountPointObserver::update()
{
if (m_referenceCount == 0) {
delete this;
- } else {
- KIO::FileSystemFreeSpaceJob *job = KIO::fileSystemFreeSpace(m_url);
- connect(job, &KJob::result, this, &MountPointObserver::freeSpaceResult);
+ return;
+ }
+ if (m_pendingJob) {
+ m_pendingJob->kill(KJob::Quietly);
}
+ m_pendingJob = KIO::fileSystemFreeSpace(m_url);
+ connect(m_pendingJob, &KJob::result, this, &MountPointObserver::freeSpaceResult);
}
void MountPointObserver::freeSpaceResult(KJob *job)