Fix crashes from uninitialized variables, small naming fix for smart pointers

This commit is contained in:
Petr Mrázek 2013-06-23 01:25:05 +02:00
parent 929698ff15
commit d9195bff3a
3 changed files with 10 additions and 7 deletions

View File

@ -29,7 +29,7 @@
#include "libmmc_config.h" #include "libmmc_config.h"
class FileToDownload; class FileToDownload;
typedef QSharedPointer<FileToDownload> PtrFileToDownload; typedef QSharedPointer<FileToDownload> FileToDownloadPtr;
class FileToDownload : public QObject class FileToDownload : public QObject
{ {
@ -49,7 +49,7 @@ class FileToDownload : public QObject
private: private:
FileToDownload(const QUrl &url, const QString &path, QObject *parent = 0); FileToDownload(const QUrl &url, const QString &path, QObject *parent = 0);
public: public:
static PtrFileToDownload Create(const QUrl &url, const QString &path, QObject *parent = 0); static FileToDownloadPtr Create(const QUrl &url, const QString &path, QObject *parent = 0);
virtual QUrl url() const { return m_dlURL; } virtual QUrl url() const { return m_dlURL; }
virtual void setURL(const QUrl &url) { m_dlURL = url; } virtual void setURL(const QUrl &url) { m_dlURL = url; }
@ -92,7 +92,7 @@ public:
virtual void executeTask(); virtual void executeTask();
virtual bool downloadFile(const PtrFileToDownload file); virtual bool downloadFile(const FileToDownloadPtr file);
////////////////////// //////////////////////
@ -155,7 +155,7 @@ private:
//////////////////////// ////////////////////////
// List of URLs that the game updater will need to download. // List of URLs that the game updater will need to download.
QList<PtrFileToDownload> m_downloadList; QList<FileToDownloadPtr> m_downloadList;
int m_currentDownload; int m_currentDownload;

View File

@ -111,7 +111,7 @@ void GameUpdateTask::executeTask()
emit gameUpdateComplete(m_response); emit gameUpdateComplete(m_response);
} }
bool GameUpdateTask::downloadFile( const PtrFileToDownload file ) bool GameUpdateTask::downloadFile( const FileToDownloadPtr file )
{ {
setSubStatus("Downloading " + file->url().toString()); setSubStatus("Downloading " + file->url().toString());
QNetworkReply *reply = netMgr->get(QNetworkRequest(file->url())); QNetworkReply *reply = netMgr->get(QNetworkRequest(file->url()));
@ -231,9 +231,9 @@ void GameUpdateTask::updateDownloadProgress(qint64 current, qint64 total)
setProgress((int)(overallDLProgress * 100)); setProgress((int)(overallDLProgress * 100));
} }
PtrFileToDownload FileToDownload::Create(const QUrl &url, const QString &path, QObject *parent) FileToDownloadPtr FileToDownload::Create(const QUrl &url, const QString &path, QObject *parent)
{ {
return PtrFileToDownload(new FileToDownload (url, path, parent)); return FileToDownloadPtr(new FileToDownload (url, path, parent));
} }
FileToDownload::FileToDownload(const QUrl &url, const QString &path, QObject *parent) : FileToDownload::FileToDownload(const QUrl &url, const QString &path, QObject *parent) :

View File

@ -160,6 +160,9 @@ MCVListLoadTask::MCVListLoadTask(MinecraftVersionList *vlist)
{ {
m_list = vlist; m_list = vlist;
m_currentStable = NULL; m_currentStable = NULL;
processedAssetsReply = false;
processedMCNReply = false;
processedMCVListReply = false;
} }
MCVListLoadTask::~MCVListLoadTask() MCVListLoadTask::~MCVListLoadTask()