From c7e63ffef5b3572704df28644962761fe5bc2a33 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 13 Jul 2017 18:11:26 +0300 Subject: [PATCH] Add some more assertions and info for crash debug. An assertion violation happens some time so add some debug info. --- Telegram/SourceFiles/dialogswidget.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 8f9f1880ec..8dc32c3872 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -758,6 +758,20 @@ bool DialogsInner::updateReorderPinned(QPoint localPosition) { } for (auto from = _draggingIndex, to = _draggingIndex + shift; from < to; ++from) { + + // Debug an assertion violation. + { + auto swapPinnedIndexWith = shownDialogs()->find(_dragging); + t_assert(swapPinnedIndexWith != shownDialogs()->cend()); + auto prevPos = (*swapPinnedIndexWith)->pos(); + ++swapPinnedIndexWith; + if (!(*swapPinnedIndexWith)->history()->isPinnedDialog()) { + SignalHandlers::setCrashAnnotation("DebugInfoBefore", QString("from: %1, to: %2, current: %3, prevPos: %4, nowPos: %5").arg(_draggingIndex).arg(_draggingIndex + shift).arg(from).arg(prevPos).arg((*swapPinnedIndexWith)->pos())); + } else { + SignalHandlers::setCrashAnnotation("DebugInfoBefore", QString()); + } + } + shownDialogs()->movePinned(_dragging, 1); std::swap(_pinnedRows[from], _pinnedRows[from + 1]); _pinnedRows[from].yadd = anim::value(_pinnedRows[from].yadd.current() + rowHeight, 0);