Browse Source

Destroy system and plugin subsystems properly so they can be re-initialized.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
7bec4bd93c
3 changed files with 3 additions and 6 deletions
  1. +1
    -2
      src/plugin.cpp
  2. +2
    -1
      src/plugin/Plugin.cpp
  3. +0
    -3
      src/system.cpp

+ 1
- 2
src/plugin.cpp View File

@@ -208,8 +208,7 @@ static void extractPackages(std::string path) {


void init() { void init() {
// Don't re-initialize // Don't re-initialize
if (!plugins.empty())
return;
assert(plugins.empty());


// Load Core // Load Core
loadPlugin(""); loadPlugin("");


+ 2
- 1
src/plugin/Plugin.cpp View File

@@ -11,7 +11,8 @@ namespace plugin {


Plugin::~Plugin() { Plugin::~Plugin() {
for (Model* model : models) { for (Model* model : models) {
delete model;
model->plugin = NULL;
// Don't delete model because it's allocated once and referenced by a global.
} }
} }




+ 0
- 3
src/system.cpp View File

@@ -539,7 +539,6 @@ std::string getStackTrace() {


static void initTime() { static void initTime() {
#if defined ARCH_WIN #if defined ARCH_WIN
assert(startCounter == 0);
LARGE_INTEGER counter; LARGE_INTEGER counter;
QueryPerformanceCounter(&counter); QueryPerformanceCounter(&counter);
startCounter = counter.QuadPart; startCounter = counter.QuadPart;
@@ -549,13 +548,11 @@ static void initTime() {
counterTime = 1.0 / frequency.QuadPart; counterTime = 1.0 / frequency.QuadPart;
#endif #endif
#if defined ARCH_LIN #if defined ARCH_LIN
assert(startTime == 0);
struct timespec ts; struct timespec ts;
clock_gettime(CLOCK_MONOTONIC_RAW, &ts); clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
startTime = int64_t(ts.tv_sec) * 1000000000LL + ts.tv_nsec; startTime = int64_t(ts.tv_sec) * 1000000000LL + ts.tv_nsec;
#endif #endif
#if defined ARCH_MAC #if defined ARCH_MAC
assert(startTime == 0);
clock_serv_t cclock; clock_serv_t cclock;
mach_timespec_t mts; mach_timespec_t mts;
host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock); host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);


Loading…
Cancel
Save