Showing the changes to libraries/script-engine/src/BatchLoader.cpp (1 of 2 files). Show all
Unified · Split
| @@ -50,47 +50,12 @@ void BatchLoader::start() { · 49 unmodified lines | ||
| 50 | 50 | checkFinished(); |
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | + // If we end up being destroyed before the reply finishes, clean it up | |
| 54 | + connect(this, &QObject::destroyed, request, &QObject::deleteLater); | |
| 55 | + | |
| 53 | 56 | qCDebug(scriptengine) << "Loading script at " << url; |
| 54 | 57 | |
| 55 | 58 | request->send(); |
| 56 | − | |
| 57 | −// if (url.scheme() == "http" || url.scheme() == "https" || url.scheme() == "ftp") { | |
| 58 | −// QNetworkRequest request = QNetworkRequest(url); | |
| 59 | −// request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); | |
| 60 | −// QNetworkReply* reply = networkAccessManager.get(request); | |
| 61 | −// | |
| 62 | −// qCDebug(scriptengine) << "Downloading file at" << url; | |
| 63 | −// | |
| 64 | −// connect(reply, &QNetworkReply::finished, [=]() { | |
| 65 | −// if (reply->error()) { | |
| 66 | −// _data.insert(url, QString()); | |
| 67 | −// } else { | |
| 68 | −// _data.insert(url, reply->readAll()); | |
| 69 | −// } | |
| 70 | −// reply->deleteLater(); | |
| 71 | −// checkFinished(); | |
| 72 | −// }); | |
| 73 | −// | |
| 74 | −// // If we end up being destroyed before the reply finishes, clean it up | |
| 75 | −// connect(this, &QObject::destroyed, reply, &QObject::deleteLater); | |
| 76 | −// | |
| 77 | −// } else { | |
| 78 | −// #ifdef _WIN32 | |
| 79 | −// QString fileName = url.toString(); | |
| 80 | −// #else | |
| 81 | −// QString fileName = url.toLocalFile(); | |
| 82 | −// #endif | |
| 83 | −// | |
| 84 | −// qCDebug(scriptengine) << "Reading file at " << fileName; | |
| 85 | −// | |
| 86 | −// QFile scriptFile(fileName); | |
| 87 | −// if (scriptFile.open(QFile::ReadOnly | QFile::Text)) { | |
| 88 | −// QTextStream in(&scriptFile); | |
| 89 | −// _data.insert(url, in.readAll()); | |
| 90 | −// } else { | |
| 91 | −// _data.insert(url, QString()); | |
| 92 | −// } | |
| 93 | −// } | |
| 94 | 59 | } |
| 95 | 60 | checkFinished(); |
| 96 | 61 | } |