From cf0812feb7227e50d32497dffc0c31742e23d37b Mon Sep 17 00:00:00 2001 From: madsciencecoder Date: Tue, 16 Feb 2016 18:09:14 -0500 Subject: [PATCH] Clean up code to give parents to QObjects. --- jsonworker.cpp | 2 +- launcherwindow.cpp | 4 ++-- loginworker.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jsonworker.cpp b/jsonworker.cpp index 18ffb34..5bf7cc1 100644 --- a/jsonworker.cpp +++ b/jsonworker.cpp @@ -36,7 +36,7 @@ void JsonWorker::startRequest(QUrl url) { QLOG_DEBUG() << "Downloading file:" << url.url(); - networkManager = new QNetworkAccessManager(); //Network manager to handle downloading the JSON document + networkManager = new QNetworkAccessManager(this); //Network manager to handle downloading the JSON document reply = networkManager->get(QNetworkRequest(url)); connect(reply, SIGNAL(finished()), this, SLOT(requestFinished())); diff --git a/launcherwindow.cpp b/launcherwindow.cpp index 2c12b2d..102f222 100644 --- a/launcherwindow.cpp +++ b/launcherwindow.cpp @@ -60,8 +60,8 @@ LauncherWindow::LauncherWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui loginIsReady = false; //Begin updating the game files - updateThread = new QThread; - UpdateWorker *updateWorker = new UpdateWorker(); + updateThread = new QThread(this); + UpdateWorker *updateWorker = new UpdateWorker(this); //make a new thread for the updating process since it can bog down the main thread and make the window unresponsive updateWorker->moveToThread(updateThread); diff --git a/loginworker.cpp b/loginworker.cpp index 8f2c3b0..aed6d18 100644 --- a/loginworker.cpp +++ b/loginworker.cpp @@ -30,7 +30,7 @@ LoginWorker::LoginWorker(QObject *parent) : QObject(parent) { - timer = new QTimer(); + timer = new QTimer(this); timer->setSingleShot(true); connect(timer, SIGNAL(timeout()), this, SLOT(timerFinished())); }