_inPinnedMsg flag now always is set to false when destroying _pinnedBar

This commit is contained in:
John Preston 2016-03-15 21:15:31 +03:00
parent 1828b14cda
commit 98b0ebcce6
1 changed files with 9 additions and 8 deletions

View File

@ -3606,9 +3606,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
_migrated->unreadBar->destroy(); _migrated->unreadBar->destroy();
} }
if (_pinnedBar) { if (_pinnedBar) {
delete _pinnedBar; destroyPinnedBar();
_pinnedBar = nullptr;
_inPinnedMsg = false;
} }
_history = _migrated = 0; _history = _migrated = 0;
updateBotKeyboard(); updateBotKeyboard();
@ -6844,9 +6842,7 @@ void HistoryWidget::updatePinnedBar(bool force) {
if (_peer && _peer->isMegagroup()) { if (_peer && _peer->isMegagroup()) {
_peer->asChannel()->mgInfo->pinnedMsgId = 0; _peer->asChannel()->mgInfo->pinnedMsgId = 0;
} }
delete _pinnedBar; destroyPinnedBar();
_pinnedBar = nullptr;
_inPinnedMsg = false;
resizeEvent(0); resizeEvent(0);
update(); update();
} }
@ -6894,8 +6890,7 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() {
App::api()->requestMessageData(_peer->asChannel(), _pinnedBar->msgId, new ReplyEditMessageDataCallback()); App::api()->requestMessageData(_peer->asChannel(), _pinnedBar->msgId, new ReplyEditMessageDataCallback());
} }
} else if (_pinnedBar) { } else if (_pinnedBar) {
delete _pinnedBar; destroyPinnedBar();
_pinnedBar = nullptr;
result = true; result = true;
_scroll.scrollToY(_scroll.scrollTop() - st::replyHeight); _scroll.scrollToY(_scroll.scrollTop() - st::replyHeight);
resizeEvent(0); resizeEvent(0);
@ -6903,6 +6898,12 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() {
return result; return result;
} }
void HistoryWidget::destroyPinnedBar() {
delete _pinnedBar;
_pinnedBar = nullptr;
_inPinnedMsg = false;
}
void HistoryWidget::ReplyEditMessageDataCallback::call(ChannelData *channel, MsgId msgId) const { void HistoryWidget::ReplyEditMessageDataCallback::call(ChannelData *channel, MsgId msgId) const {
if (App::main()) { if (App::main()) {
App::main()->messageDataReceived(channel, msgId); App::main()->messageDataReceived(channel, msgId);