From df923e0301a373eb1c112d94d20e87099ac28d32 Mon Sep 17 00:00:00 2001
From: Akira Ohgaki <akiraohgaki@gmail.com>
Date: Sat, 19 Nov 2016 09:16:15 +0900
Subject: [PATCH] Delete finished object

---
 src/app/handlers/xdgurl.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/app/handlers/xdgurl.cpp b/src/app/handlers/xdgurl.cpp
index 0a7e442..fa37eeb 100644
--- a/src/app/handlers/xdgurl.cpp
+++ b/src/app/handlers/xdgurl.cpp
@@ -81,6 +81,7 @@ void XdgUrl::networkResourceFinished(qtlibs::NetworkResource *resource)
         QJsonObject result;
         result["status"] = QString("error_network");
         result["message"] = resource->reply()->errorString();
+        resource->deleteLater();
         emit finishedWithError(result);
         return;
     }
@@ -176,10 +177,13 @@ void XdgUrl::saveDownloadedFile(qtlibs::NetworkResource *resource)
     if (!resource->saveData(path)) {
         result["status"] = QString("error_save");
         result["message"] = QString("Failed to save data as " + path);
+        resource->deleteLater();
         emit finishedWithError(result);
         return;
     }
 
+    resource->deleteLater();
+
     destination_ = destination;
 
     result["status"] = QString("success_download");
@@ -196,10 +200,13 @@ void XdgUrl::installDownloadedFile(qtlibs::NetworkResource *resource)
     if (!resource->saveData(tempPath)) {
         result["status"] = QString("error_save");
         result["message"] = QString("Failed to save data as " + tempPath);
+        resource->deleteLater();
         emit finishedWithError(result);
         return;
     }
 
+    resource->deleteLater();
+
     qtlibs::Package package(tempPath);
     qtlibs::File tempFile(tempPath);
 
-- 
GitLab