From 529d87ee12ca91032c8423c7bec0f8087f096769 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 14 Jan 2020 14:47:19 -0500 Subject: [PATCH] Remove contextInit() and contextDestroy() since they don't really make sense with multiple instances. --- src/context.cpp | 12 ------------ src/main.cpp | 6 ++++-- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/context.cpp b/src/context.cpp index 7e3c75c0..33d24c6f 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -47,18 +47,6 @@ Context::~Context() { static thread_local Context* context = NULL; -void contextInit() { - assert(!context); - context = new Context; - context->init(); -} - -void contextDestroy() { - assert(context); - delete context; - context = NULL; -} - Context* contextGet() { assert(context); return context; diff --git a/src/main.cpp b/src/main.cpp index a32d3b74..9cab2dc3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -173,7 +173,8 @@ int main(int argc, char* argv[]) { // Initialize context INFO("Initializing context"); - contextInit(); + contextSet(new Context); + APP->init(); // On Mac, use a hacked-in GLFW addition to get the launched path. #if defined ARCH_MAC @@ -221,7 +222,8 @@ int main(int argc, char* argv[]) { settings::patchPath = APP->patch->path; } INFO("Destroying context"); - contextDestroy(); + delete APP; + contextSet(NULL); if (!settings::headless) { settings::save(asset::settingsPath); }