Add some more debug info for crashes.

This commit is contained in:
John Preston 2017-11-22 15:10:11 +04:00
parent 5803edb77b
commit f477aea2a5
3 changed files with 25 additions and 4 deletions

View File

@ -1661,11 +1661,11 @@ void History::addOlderSlice(const QVector<MTPMessage> &slice) {
logged.push_back(QString::number(minAdded));
logged.push_back(QString::number(maxAdded));
SignalHandlers::setCrashAnnotation("add", logged.join(";"));
SignalHandlers::setCrashAnnotation("old_minmaxwas_minmaxadd", logged.join(";"));
addBlockToSharedMedia(block);
SignalHandlers::setCrashAnnotation("add", "");
SignalHandlers::setCrashAnnotation("old_minmaxwas_minmaxadd", "");
if (isChannel()) {
asChannelHistory()->checkJoinedMessage();
@ -1723,7 +1723,7 @@ void History::addNewerSlice(const QVector<MTPMessage> &slice) {
}
logged.push_back(QString::number(minAdded));
logged.push_back(QString::number(maxAdded));
SignalHandlers::setCrashAnnotation("add", logged.join(";"));
SignalHandlers::setCrashAnnotation("new_minmaxwas_minmaxadd", logged.join(";"));
if (!atLeastOneAdded) {
newLoaded = true;
@ -1731,7 +1731,7 @@ void History::addNewerSlice(const QVector<MTPMessage> &slice) {
}
addToSharedMedia(medias, wasLoadedAtBottom != loadedAtBottom());
SignalHandlers::setCrashAnnotation("add", "");
SignalHandlers::setCrashAnnotation("new_minmaxwas_minmaxadd", "");
}
if (!wasLoadedAtBottom) {

View File

@ -2316,7 +2316,13 @@ void HistoryWidget::messagesReceived(PeerData *peer, const MTPmessages_Messages
}
if (_preloadRequest == requestId) {
auto to = toMigrated ? _migrated : _history;
SignalHandlers::setCrashAnnotation("old_minmaxbefore_minmaxnow", QString("%1;%2;%3;%4").arg(_debug_preloadMin).arg(_debug_preloadMax).arg(to->minMsgId()).arg(to->maxMsgId()));
addMessagesToFront(peer, *histList);
SignalHandlers::setCrashAnnotation("old_minmaxbefore_minmaxnow", QString());
_preloadRequest = 0;
preloadHistoryIfNeeded();
if (_reportSpamStatus == dbiprsUnknown) {
@ -2324,7 +2330,13 @@ void HistoryWidget::messagesReceived(PeerData *peer, const MTPmessages_Messages
if (_reportSpamStatus != dbiprsUnknown) updateControlsVisibility();
}
} else if (_preloadDownRequest == requestId) {
auto to = toMigrated ? _migrated : _history;
SignalHandlers::setCrashAnnotation("new_minmaxbefore_minmaxnow", QString("%1;%2;%3;%4").arg(_debug_preloadDownMin).arg(_debug_preloadDownMax).arg(to->minMsgId()).arg(to->maxMsgId()));
addMessagesToBack(peer, *histList);
SignalHandlers::setCrashAnnotation("new_minmaxbefore_minmaxnow", QString());
_preloadDownRequest = 0;
preloadHistoryIfNeeded();
if (_history->loadedAtBottom() && App::wnd()) App::wnd()->checkHistoryActivation();
@ -2516,6 +2528,8 @@ void HistoryWidget::loadMessages() {
auto minId = 0;
auto historyHash = 0;
_debug_preloadMin = from->minMsgId();
_debug_preloadMax = from->maxMsgId();
_preloadRequest = MTP::send(
MTPmessages_GetHistory(
from->peer->input,
@ -2556,6 +2570,8 @@ void HistoryWidget::loadMessagesDown() {
auto minId = 0;
auto historyHash = 0;
_debug_preloadDownMin = from->minMsgId();
_debug_preloadDownMax = from->maxMsgId();
_preloadDownRequest = MTP::send(
MTPmessages_GetHistory(
from->peer->input,

View File

@ -725,6 +725,11 @@ private:
mtpRequestId _preloadRequest = 0;
mtpRequestId _preloadDownRequest = 0;
MsgId _debug_preloadMin = 0;
MsgId _debug_preloadMax = 0;
MsgId _debug_preloadDownMin = 0;
MsgId _debug_preloadDownMax = 0;
MsgId _delayedShowAtMsgId = -1; // wtf?
mtpRequestId _delayedShowAtRequest = 0;