crash on close fixed

This commit is contained in:
John Preston 2015-12-28 20:23:27 +03:00
parent 9a3489694e
commit 43e173567f
3 changed files with 7 additions and 4 deletions

View file

@ -202,7 +202,7 @@ namespace App {
globalNotifyAllPtr = UnknownNotifySettings;
globalNotifyUsersPtr = UnknownNotifySettings;
globalNotifyChatsPtr = UnknownNotifySettings;
App::uploader()->clear();
if (App::uploader()) App::uploader()->clear();
clearStorageImages();
if (w) {
w->getTitle()->updateBackButton();

View file

@ -489,7 +489,7 @@ int32 Application::updatingReady() {
#endif
FileUploader *Application::uploader() {
if (!::uploader) ::uploader = new FileUploader();
if (!::uploader && !App::quiting()) ::uploader = new FileUploader();
return ::uploader;
}
@ -878,6 +878,7 @@ void Application::closeApplication() {
Application::~Application() {
App::setQuiting();
window->setParent(0);
anim::stopManager();
@ -886,8 +887,10 @@ Application::~Application() {
closeApplication();
App::deinitMedia();
deinitImageLinkManager();
mainApp = 0;
delete ::uploader;
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
delete updateReply;
updateReply = 0;

View file

@ -2968,8 +2968,8 @@ void HistoryItem::setId(MsgId newId) {
HistoryItem::~HistoryItem() {
App::historyUnregItem(this);
if (id < 0) {
App::app()->uploader()->cancel(fullId());
if (id < 0 && App::uploader()) {
App::uploader()->cancel(fullId());
}
}