diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index 4cc7edd41f..5a1e5d5200 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -1021,4 +1021,8 @@ namespace SignalHandlers { } } + void setAssertionInfo(const QString &info) { + ProcessAnnotations["Assertion"] = info.toUtf8().constData(); + } + } diff --git a/Telegram/SourceFiles/logs.h b/Telegram/SourceFiles/logs.h index 1599ee408a..6e997e4cf7 100644 --- a/Telegram/SourceFiles/logs.h +++ b/Telegram/SourceFiles/logs.h @@ -108,5 +108,6 @@ namespace SignalHandlers { void finish(); void setSelfUsername(const QString &username); + void setAssertionInfo(const QString &info); } diff --git a/Telegram/SourceFiles/pspecific_wnd.cpp b/Telegram/SourceFiles/pspecific_wnd.cpp index 3dc358887b..898ac1cee8 100644 --- a/Telegram/SourceFiles/pspecific_wnd.cpp +++ b/Telegram/SourceFiles/pspecific_wnd.cpp @@ -851,8 +851,10 @@ namespace { } else { _psShadowWindows.setColor(_shInactive); } - QTimer::singleShot(0, App::wnd(), SLOT(updateCounter())); - App::wnd()->update(); + if (Global::started()) { + QMetaObject::invokeMethod(App::wnd(), "updateCounter", Qt::QueuedConnection); + App::wnd()->update(); + } } return false; case WM_NCPAINT: if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8) return false; *result = 0; return true; diff --git a/Telegram/SourceFiles/types.h b/Telegram/SourceFiles/types.h index 5cf498de29..a415cb8b8a 100644 --- a/Telegram/SourceFiles/types.h +++ b/Telegram/SourceFiles/types.h @@ -68,6 +68,9 @@ public: }; +#define qsl(s) QStringLiteral(s) +#define qstr(s) QLatin1String(s, sizeof(s) - 1) + //typedef unsigned char uchar; // Qt has uchar typedef qint16 int16; typedef quint16 uint16; @@ -109,7 +112,9 @@ using std::swap; static volatile int *t_assert_nullptr = 0; inline void t_noop() {} inline void t_assert_fail(const char *message, const char *file, int32 line) { - LOG(("Assertion Failed! %1 %2:%3").arg(message).arg(file).arg(line)); + QString info(qsl("%1 %2:%3").arg(message).arg(file).arg(line)); + LOG(("Assertion Failed! %1 %2:%3").arg(info)); + SignalHandlers::setAssertionInfo(info); *t_assert_nullptr = 0; } #define t_assert_full(condition, message, file, line) ((!(condition)) ? t_assert_fail(message, file, line) : t_noop()) @@ -277,9 +282,6 @@ private: }; -#define qsl(s) QStringLiteral(s) -#define qstr(s) QLatin1String(s, sizeof(s) - 1) - inline QString fromUtf8Safe(const char *str, int32 size = -1) { if (!str || !size) return QString(); if (size < 0) size = int32(strlen(str)); diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp index 66a3a02a11..aef78db088 100644 --- a/Telegram/SourceFiles/window.cpp +++ b/Telegram/SourceFiles/window.cpp @@ -697,6 +697,8 @@ void Window::setupMain(bool anim, const MTPUser *self) { } void Window::updateCounter() { + if (App::quitting()) return; + psUpdateCounter(); title->updateCounter(); }