diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cpp/server/server.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index cc52c98b17..377c1ed167 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -60,12 +60,10 @@ class DefaultGlobalCallbacks GRPC_FINAL : public Server::GlobalCallbacks { static Server::GlobalCallbacks* g_callbacks = nullptr; static gpr_once g_once_init_callbacks = GPR_ONCE_INIT; -static void DeleteGlobalCallbacks() { delete g_callbacks; } - static void InitGlobalCallbacks() { if (g_callbacks == nullptr) { - g_callbacks = new DefaultGlobalCallbacks(); - atexit(DeleteGlobalCallbacks); + static DefaultGlobalCallbacks default_global_callbacks; + g_callbacks = &default_global_callbacks; } } |