diff --git a/td/telegram/Global.h b/td/telegram/Global.h index 564dc8e2..a70b592c 100644 --- a/td/telegram/Global.h +++ b/td/telegram/Global.h @@ -78,6 +78,7 @@ class Global : public ActorContext { LOG_CHECK(td_db_) << close_flag() << " " << file << " " << line; return td_db_.get(); } + void close_all(Promise<> on_finished); void close_and_destroy_all(Promise<> on_finished); @@ -425,10 +426,12 @@ class Global : public ActorContext { void do_close(Promise<> on_finish, bool destroy_flag); }; -inline Global *G() { +#define G() G_impl(__FILE__, __LINE__) + +inline Global *G_impl(const char *file, int line) { ActorContext *context = Scheduler::context(); CHECK(context); - CHECK(context->get_id() == Global::ID); + LOG_CHECK(context->get_id() == Global::ID) << "In " << file << " at " << line; return static_cast(context); } diff --git a/td/telegram/SecretChatActor.cpp b/td/telegram/SecretChatActor.cpp index f6f233f3..67f669cb 100644 --- a/td/telegram/SecretChatActor.cpp +++ b/td/telegram/SecretChatActor.cpp @@ -39,7 +39,8 @@ #include #include -#define G GLOBAL_SHOULD_NOT_BE_USED_HERE +//#define G GLOBAL_SHOULD_NOT_BE_USED_HERE +#undef G namespace td { diff --git a/td/telegram/logevent/LogEventHelper.h b/td/telegram/logevent/LogEventHelper.h index f286f7b6..f3be2705 100644 --- a/td/telegram/logevent/LogEventHelper.h +++ b/td/telegram/logevent/LogEventHelper.h @@ -22,7 +22,7 @@ namespace td { #define get_erase_logevent_promise(...) get_erase_logevent_promise_impl(__FILE__, __LINE__, __VA_ARGS__) -inline Promise get_erase_logevent_promise_impl(const char *file, int32 line, uint64 logevent_id, +inline Promise get_erase_logevent_promise_impl(const char *file, int line, uint64 logevent_id, Promise promise = Promise()) { if (logevent_id == 0) { return promise;