Commit 71a5c8b8 authored by Max Kellermann's avatar Max Kellermann

Main: allocate Instance on the stack

parent 620a39af
...@@ -33,5 +33,5 @@ idle_add(unsigned flags) ...@@ -33,5 +33,5 @@ idle_add(unsigned flags)
{ {
assert(flags != 0); assert(flags != 0);
instance->EmitIdle(flags); global_instance->EmitIdle(flags);
} }
...@@ -31,7 +31,7 @@ extern Context *context; ...@@ -31,7 +31,7 @@ extern Context *context;
extern LogListener *logListener; extern LogListener *logListener;
#endif #endif
extern Instance *instance; extern Instance *global_instance;
#ifndef ANDROID #ifndef ANDROID
......
...@@ -66,10 +66,10 @@ map_uri_fs(const char *uri) noexcept ...@@ -66,10 +66,10 @@ map_uri_fs(const char *uri) noexcept
assert(uri != nullptr); assert(uri != nullptr);
assert(*uri != '/'); assert(*uri != '/');
if (instance->storage == nullptr) if (global_instance->storage == nullptr)
return nullptr; return nullptr;
const auto music_dir_fs = instance->storage->MapFS(""); const auto music_dir_fs = global_instance->storage->MapFS("");
if (music_dir_fs.IsNull()) if (music_dir_fs.IsNull())
return nullptr; return nullptr;
...@@ -84,10 +84,10 @@ std::string ...@@ -84,10 +84,10 @@ std::string
map_fs_to_utf8(Path path_fs) noexcept map_fs_to_utf8(Path path_fs) noexcept
{ {
if (path_fs.IsAbsolute()) { if (path_fs.IsAbsolute()) {
if (instance->storage == nullptr) if (global_instance->storage == nullptr)
return std::string(); return std::string();
const auto music_dir_fs = instance->storage->MapFS(""); const auto music_dir_fs = global_instance->storage->MapFS("");
if (music_dir_fs.IsNull()) if (music_dir_fs.IsNull())
return std::string(); return std::string();
......
...@@ -70,7 +70,7 @@ service_dispatcher(gcc_unused DWORD control, gcc_unused DWORD event_type, ...@@ -70,7 +70,7 @@ service_dispatcher(gcc_unused DWORD control, gcc_unused DWORD event_type,
switch (control) { switch (control) {
case SERVICE_CONTROL_SHUTDOWN: case SERVICE_CONTROL_SHUTDOWN:
case SERVICE_CONTROL_STOP: case SERVICE_CONTROL_STOP:
instance->Break(); global_instance->Break();
return NO_ERROR; return NO_ERROR;
default: default:
return NO_ERROR; return NO_ERROR;
...@@ -106,7 +106,7 @@ console_handler(DWORD event) ...@@ -106,7 +106,7 @@ console_handler(DWORD event)
// regardless our thread is still active. // regardless our thread is still active.
// If this did not happen within 3 seconds // If this did not happen within 3 seconds
// let's shutdown anyway. // let's shutdown anyway.
instance->Break(); global_instance->Break();
// Under debugger it's better to wait indefinitely // Under debugger it's better to wait indefinitely
// to allow debugging of shutdown code. // to allow debugging of shutdown code.
Sleep(IsDebuggerPresent() ? INFINITE : 3000); Sleep(IsDebuggerPresent() ? INFINITE : 3000);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment