fixed crash in mtpFileLoader delayed destroy, finishing breakpad at the very end, 0.9.29 dev

This commit is contained in:
John Preston 2016-03-01 21:41:06 +02:00
parent ebfeeb6872
commit cde264e5a1
6 changed files with 34 additions and 25 deletions

View File

@ -344,23 +344,6 @@ void Application::closeApplication() {
if (_updateThread) _updateThread->quit();
_updateThread = 0;
#endif
DEBUG_LOG(("Telegram finished, result: %1").arg("unknown"));
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
if (cRestartingUpdate()) {
DEBUG_LOG(("Application Info: executing updater to install update.."));
psExecUpdater();
} else
#endif
if (cRestarting()) {
DEBUG_LOG(("Application Info: executing Telegram, because of restart.."));
psExecTelegram();
}
SignalHandlers::finish();
PlatformSpecific::finish();
Logs::finish();
}
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
@ -1067,7 +1050,7 @@ AppClass::~AppClass() {
App::deinitMedia();
deinitImageLinkManager();
MTP::stop();
MTP::finish();
AppObject = 0;
deleteAndMark(_uploader);

View File

@ -43,6 +43,26 @@ int main(int argc, char *argv[]) {
//int a_argc = a_cnt + 1;
//char *a_argv[a_cnt + 1] = { argv[0], args[0].data() };
Application app(argc, argv);
return app.exec();
int result = 0;
{
Application app(argc, argv);
result = app.exec();
}
DEBUG_LOG(("Telegram finished, result: %1").arg(result));
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
if (cRestartingUpdate()) {
DEBUG_LOG(("Application Info: executing updater to install update.."));
psExecUpdater();
} else
#endif
if (cRestarting()) {
DEBUG_LOG(("Application Info: executing Telegram, because of restart.."));
psExecTelegram();
}
SignalHandlers::finish();
PlatformSpecific::finish();
Logs::finish();
}

View File

@ -758,6 +758,8 @@ namespace MTP {
}
void cancel(mtpRequestId requestId) {
if (!_started) return;
mtpMsgId msgId = 0;
requestsDelays.remove(requestId);
{
@ -831,7 +833,7 @@ namespace MTP {
return MTP::RequestConnecting;
}
void stop() {
void finish() {
for (Sessions::iterator i = sessions.begin(), e = sessions.end(); i != e; ++i) {
i.value()->kill();
delete i.value();

View File

@ -132,9 +132,7 @@ namespace MTP {
};
int32 state(mtpRequestId req); // < 0 means waiting for such count of ms
void defOnError(const RPCError &err);
void stop();
void finish();
void authed(int32 uid);
int32 authedId();

View File

@ -527,7 +527,7 @@ void mtpFileLoader::cancelRequests() {
_queue->queries -= _requests.size();
_requests.clear();
if (!_queue->queries) {
if (!_queue->queries && App::app()) {
App::app()->killDownloadSessionsStart(_dc);
}
}

View File

@ -1393,6 +1393,12 @@ void DocumentData::recountIsImage() {
DocumentData::~DocumentData() {
delete _additional;
if (loading()) {
_loader->deleteLater();
_loader->stop();
_loader = 0;
}
}
WebPageData::WebPageData(const WebPageId &id, WebPageType type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, DocumentData *doc, int32 duration, const QString &author, int32 pendingTill) : id(id)