Crash if someone tries to create a request handlet while closing.

GitOrigin-RevId: 95f188a0d4acf58e5c72d9ea3abc3145cf82026d
This commit is contained in:
levlam 2019-03-18 01:51:43 +03:00
parent 8cbbe017bd
commit ad6ee1ed94
3 changed files with 13 additions and 0 deletions

View File

@ -8629,6 +8629,10 @@ void MessagesManager::set_dialog_online_member_count(DialogId dialog_id, int32 o
}
void MessagesManager::on_update_dialog_online_member_count_timeout(DialogId dialog_id) {
if (G()->close_flag()) {
return;
}
LOG(INFO) << "Expired timeout for online member count for " << dialog_id;
Dialog *d = get_dialog(dialog_id);
CHECK(d != nullptr);
@ -23269,6 +23273,7 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
d->new_secret_chat_notification_id.get() <= d->message_notification_group.max_removed_notification_id.get()) {
VLOG(notifications) << "Fix removing new secret chat " << d->new_secret_chat_notification_id << " in " << dialog_id;
d->new_secret_chat_notification_id = NotificationId();
on_dialog_updated(d->dialog_id, "fix new secret chat notification id");
}
auto pending_it = pending_add_dialog_last_database_message_dependent_dialogs_.find(dialog_id);

View File

@ -753,6 +753,9 @@ void PollManager::on_update_poll_timeout(PollId poll_id) {
CHECK(!td_->auth_manager_->is_bot());
CHECK(!is_local_poll_id(poll_id));
if (G()->close_flag()) {
return;
}
if (get_poll_is_closed(poll_id)) {
return;
}

View File

@ -205,6 +205,11 @@ class Td final : public NetQueryCallback {
template <class HandlerT, class... Args>
std::shared_ptr<HandlerT> create_handler(Args &&... args) {
LOG_CHECK(close_flag_ < 2) << close_flag_
#if TD_CLANG || TD_GCC
<< ' ' << __PRETTY_FUNCTION__
#endif
;
auto ptr = std::make_shared<HandlerT>(std::forward<Args>(args)...);
ptr->set_td(this);
return ptr;