1
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-04-01 00:08:02 +00:00

Fix possible crashes in topic / history deletion.

This commit is contained in:
John Preston 2022-11-03 13:26:36 +04:00
parent b5a412929e
commit da941e4837
2 changed files with 12 additions and 5 deletions

View File

@ -6078,7 +6078,8 @@ void HistoryWidget::updatePinnedViewer() {
|| _delayedShowAtRequest || _delayedShowAtRequest
|| _scroll->isHidden() || _scroll->isHidden()
|| !_history || !_history
|| !_historyInited) { || !_historyInited
|| !_pinnedTracker) {
return; return;
} }
const auto visibleBottom = _scroll->scrollTop() + _scroll->height(); const auto visibleBottom = _scroll->scrollTop() + _scroll->height();
@ -6217,8 +6218,8 @@ void HistoryWidget::checkPinnedBarState() {
})); }));
controller()->adaptive().oneColumnValue( controller()->adaptive().oneColumnValue(
) | rpl::start_with_next([=](bool one) { ) | rpl::start_with_next([=, raw = _pinnedBar.get()](bool one) {
_pinnedBar->setShadowGeometryPostprocess([=](QRect geometry) { raw->setShadowGeometryPostprocess([=](QRect geometry) {
if (!one) { if (!one) {
geometry.setLeft(geometry.left() + st::lineWidth); geometry.setLeft(geometry.left() + st::lineWidth);
} }
@ -6305,6 +6306,9 @@ void HistoryWidget::setChooseReportMessagesDetails(
} }
void HistoryWidget::refreshPinnedBarButton(bool many, HistoryItem *item) { void HistoryWidget::refreshPinnedBarButton(bool many, HistoryItem *item) {
if (!_pinnedBar) {
return; // It can be in process of hiding.
}
const auto openSection = [=] { const auto openSection = [=] {
const auto id = _pinnedTracker const auto id = _pinnedTracker
? _pinnedTracker->currentMessageId() ? _pinnedTracker->currentMessageId()

View File

@ -1614,8 +1614,8 @@ void RepliesWidget::checkPinnedBarState() {
})); }));
controller()->adaptive().oneColumnValue( controller()->adaptive().oneColumnValue(
) | rpl::start_with_next([=](bool one) { ) | rpl::start_with_next([=, raw = _pinnedBar.get()](bool one) {
_pinnedBar->setShadowGeometryPostprocess([=](QRect geometry) { raw->setShadowGeometryPostprocess([=](QRect geometry) {
if (!one) { if (!one) {
geometry.setLeft(geometry.left() + st::lineWidth); geometry.setLeft(geometry.left() + st::lineWidth);
} }
@ -1657,6 +1657,9 @@ void RepliesWidget::checkPinnedBarState() {
} }
void RepliesWidget::refreshPinnedBarButton(bool many, HistoryItem *item) { void RepliesWidget::refreshPinnedBarButton(bool many, HistoryItem *item) {
if (!_pinnedBar) {
return; // It can be in process of hiding.
}
const auto openSection = [=] { const auto openSection = [=] {
const auto id = _pinnedTracker const auto id = _pinnedTracker
? _pinnedTracker->currentMessageId() ? _pinnedTracker->currentMessageId()