summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft/legacy
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-11-06 21:58:54 +0100
committerPetr Mrázek <peterix@gmail.com>2016-11-06 21:58:54 +0100
commit8b952b387041341f556edcf0bb34576a2fc88568 (patch)
tree804b8976355ef3950628647370e7dfc1bdf96b4f /api/logic/minecraft/legacy
parent37cc59c04d0573a42d67242135495c0a0729f965 (diff)
downloadMultiMC-8b952b387041341f556edcf0bb34576a2fc88568.tar
MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.tar.gz
MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.tar.lz
MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.tar.xz
MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.zip
NOISSUE Refactor and sanitize MultiMC startup/shutdown
* Always create main window. * Properly handle netowrk manager - it was created twice, leading to potential crashes.
Diffstat (limited to 'api/logic/minecraft/legacy')
-rw-r--r--api/logic/minecraft/legacy/LegacyUpdate.cpp6
-rw-r--r--api/logic/minecraft/legacy/LwjglVersionList.cpp3
2 files changed, 4 insertions, 5 deletions
diff --git a/api/logic/minecraft/legacy/LegacyUpdate.cpp b/api/logic/minecraft/legacy/LegacyUpdate.cpp
index a0d1933f..cbca1019 100644
--- a/api/logic/minecraft/legacy/LegacyUpdate.cpp
+++ b/api/logic/minecraft/legacy/LegacyUpdate.cpp
@@ -195,7 +195,7 @@ void LegacyUpdate::lwjglStart()
QString url = version->url();
QUrl realUrl(url);
QString hostname = realUrl.host();
- auto worker = ENV.qnam();
+ auto worker = &ENV.qnam();
QNetworkRequest req(realUrl);
req.setRawHeader("Host", hostname.toLatin1());
req.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Cached)");
@@ -203,7 +203,7 @@ void LegacyUpdate::lwjglStart()
m_reply = std::shared_ptr<QNetworkReply>(rep);
connect(rep, &QNetworkReply::downloadProgress, this, &LegacyUpdate::progress);
- connect(worker.get(), &QNetworkAccessManager::finished, this, &LegacyUpdate::lwjglFinished);
+ connect(worker, &QNetworkAccessManager::finished, this, &LegacyUpdate::lwjglFinished);
}
void LegacyUpdate::lwjglFinished(QNetworkReply *reply)
@@ -219,7 +219,7 @@ void LegacyUpdate::lwjglFinished(QNetworkReply *reply)
"a row. YMMV");
return;
}
- auto worker = ENV.qnam();
+ auto worker = &ENV.qnam();
// Here i check if there is a cookie for me in the reply and extract it
QList<QNetworkCookie> cookies =
qvariant_cast<QList<QNetworkCookie>>(reply->header(QNetworkRequest::SetCookieHeader));
diff --git a/api/logic/minecraft/legacy/LwjglVersionList.cpp b/api/logic/minecraft/legacy/LwjglVersionList.cpp
index bb017368..427032a4 100644
--- a/api/logic/minecraft/legacy/LwjglVersionList.cpp
+++ b/api/logic/minecraft/legacy/LwjglVersionList.cpp
@@ -82,11 +82,10 @@ void LWJGLVersionList::loadList()
Q_ASSERT_X(!m_loading, "loadList", "list is already loading (m_loading is true)");
setLoading(true);
- auto worker = ENV.qnam();
QNetworkRequest req(QUrl(RSS_URL));
req.setRawHeader("Accept", "application/rss+xml, text/xml, */*");
req.setRawHeader("User-Agent", "MultiMC/5.0 (Uncached)");
- reply = worker->get(req);
+ reply = ENV.qnam().get(req);
connect(reply, SIGNAL(finished()), SLOT(netRequestComplete()));
}