diff --git a/src/webui/httpconnection.cpp b/src/webui/httpconnection.cpp index 70b647749..ca642655a 100644 --- a/src/webui/httpconnection.cpp +++ b/src/webui/httpconnection.cpp @@ -403,7 +403,7 @@ void HttpConnection::respondCommand(const QString& command) { tmpfile->write(m_parser.torrent()); tmpfile->close(); emit torrentReadyToBeDownloaded(tmpfile->fileName(), false, QString(), false); - delete tmpfile; + tmpfile->deleteLater(); } else { std::cerr << "I/O Error: Could not create temporary file" << std::endl; delete tmpfile; diff --git a/src/webui/httprequestparser.cpp b/src/webui/httprequestparser.cpp index 42668e01e..b06dd1ae6 100644 --- a/src/webui/httprequestparser.cpp +++ b/src/webui/httprequestparser.cpp @@ -61,7 +61,7 @@ QString HttpRequestParser::post(const QString& key) const { return m_postMap.value(key); } -QByteArray HttpRequestParser::torrent() const { +const QByteArray& HttpRequestParser::torrent() const { return m_torrentContent; } diff --git a/src/webui/httprequestparser.h b/src/webui/httprequestparser.h index 5f8071794..e5fc03891 100644 --- a/src/webui/httprequestparser.h +++ b/src/webui/httprequestparser.h @@ -44,7 +44,7 @@ public: QByteArray message() const; QString get(const QString& key) const; QString post(const QString& key) const; - QByteArray torrent() const; + const QByteArray& torrent() const; void write(const QByteArray& ba); inline QHttpRequestHeader& header() { return m_header; }