mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix crash in emoji statuses clearing.
This commit is contained in:
parent
16649a9661
commit
70ba28bbd5
2 changed files with 9 additions and 4 deletions
|
@ -119,8 +119,7 @@ void EmojiStatuses::registerAutomaticClear(
|
||||||
if (i->first == user) {
|
if (i->first == user) {
|
||||||
const auto now = base::unixtime::now();
|
const auto now = base::unixtime::now();
|
||||||
if (now < until) {
|
if (now < until) {
|
||||||
const auto waitms = (until - now) * crl::time(1000);
|
processClearingIn(until - now);
|
||||||
_clearingTimer.callOnce(std::min(waitms, kMaxTimeout));
|
|
||||||
} else {
|
} else {
|
||||||
processClearing();
|
processClearing();
|
||||||
}
|
}
|
||||||
|
@ -153,12 +152,17 @@ void EmojiStatuses::processClearing() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (minWait) {
|
if (minWait) {
|
||||||
_clearingTimer.callOnce(minWait * crl::time(1000));
|
processClearingIn(minWait);
|
||||||
} else {
|
} else {
|
||||||
_clearingTimer.cancel();
|
_clearingTimer.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EmojiStatuses::processClearingIn(TimeId wait) {
|
||||||
|
const auto waitms = wait * crl::time(1000);
|
||||||
|
_clearingTimer.callOnce(std::min(waitms, kMaxTimeout));
|
||||||
|
}
|
||||||
|
|
||||||
void EmojiStatuses::requestRecent() {
|
void EmojiStatuses::requestRecent() {
|
||||||
if (_recentRequestId) {
|
if (_recentRequestId) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -62,6 +62,7 @@ private:
|
||||||
void updateDefault(const MTPDaccount_emojiStatuses &data);
|
void updateDefault(const MTPDaccount_emojiStatuses &data);
|
||||||
void updateColored(const MTPDmessages_stickerSet &data);
|
void updateColored(const MTPDmessages_stickerSet &data);
|
||||||
|
|
||||||
|
void processClearingIn(TimeId wait);
|
||||||
void processClearing();
|
void processClearing();
|
||||||
|
|
||||||
const not_null<Session*> _owner;
|
const not_null<Session*> _owner;
|
||||||
|
@ -85,7 +86,7 @@ private:
|
||||||
|
|
||||||
mtpRequestId _sentRequestId = 0;
|
mtpRequestId _sentRequestId = 0;
|
||||||
|
|
||||||
base::flat_map<not_null<UserData*>, crl::time> _clearing;
|
base::flat_map<not_null<UserData*>, TimeId> _clearing;
|
||||||
base::Timer _clearingTimer;
|
base::Timer _clearingTimer;
|
||||||
|
|
||||||
rpl::lifetime _lifetime;
|
rpl::lifetime _lifetime;
|
||||||
|
|
Loading…
Add table
Reference in a new issue