From d93c06fceb3f2628f8ee01b12058e00a6df7c5e7 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 17 May 2023 13:45:26 +0300 Subject: [PATCH] Remove unsafe Status::operator==. --- td/telegram/RequestActor.h | 2 +- tdutils/td/utils/Status.h | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/td/telegram/RequestActor.h b/td/telegram/RequestActor.h index ff1bd391c..32ab0a91c 100644 --- a/td/telegram/RequestActor.h +++ b/td/telegram/RequestActor.h @@ -67,7 +67,7 @@ class RequestActor : public Actor { void raw_event(const Event::Raw &event) final { if (future_.is_error()) { auto error = future_.move_as_error(); - if (error == Status::Error::HANGUP_ERROR_CODE>()) { + if (error.is_static() && error.code() == FutureActor::HANGUP_ERROR_CODE) { // dropping query due to closing or lost promise if (G()->close_flag()) { do_send_error(Global::request_aborted_error()); diff --git a/tdutils/td/utils/Status.h b/tdutils/td/utils/Status.h index 768963f21..94b17bc6e 100644 --- a/tdutils/td/utils/Status.h +++ b/tdutils/td/utils/Status.h @@ -151,8 +151,11 @@ class Status { public: Status() = default; - bool operator==(const Status &other) const { - return ptr_ == other.ptr_; + bool is_static() const { + if (is_ok()) { + return true; + } + return get_info().static_flag; } Status clone() const TD_WARN_UNUSED_RESULT {