From c59b5fb5e6bf7c8b5d0b1edaa9db791262ee9e43 Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Thu, 7 Apr 2016 17:05:13 -0400 Subject: [PATCH] [node] don't dispose parent module in NodeLog destructor --- platform/node/src/node_log.cpp | 1 - platform/node/src/node_mapbox_gl_native.cpp | 2 +- platform/node/test/js/require.js | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 platform/node/test/js/require.js diff --git a/platform/node/src/node_log.cpp b/platform/node/src/node_log.cpp index 8230bb36ce3..a741109b27e 100644 --- a/platform/node/src/node_log.cpp +++ b/platform/node/src/node_log.cpp @@ -52,7 +52,6 @@ NodeLogObserver::NodeLogObserver(v8::Local target) NodeLogObserver::~NodeLogObserver() { queue->stop(); - module.Reset(); } bool NodeLogObserver::onRecord(mbgl::EventSeverity severity, mbgl::Event event, int64_t code, const std::string &text) { diff --git a/platform/node/src/node_mapbox_gl_native.cpp b/platform/node/src/node_mapbox_gl_native.cpp index 2a9e9fb6c3d..28df6af01c5 100644 --- a/platform/node/src/node_mapbox_gl_native.cpp +++ b/platform/node/src/node_mapbox_gl_native.cpp @@ -77,7 +77,7 @@ void RegisterModule(v8::Local target, v8::Local module) Nan::Get(EventEmitter, Nan::New("prototype").ToLocalChecked()).ToLocalChecked()); Nan::CallAsFunction(EventEmitter, target, 0, nullptr); - mbgl::Log::setObserver(std::make_unique(target->ToObject())); + mbgl::Log::setObserver(std::make_unique(target)); } NODE_MODULE(mapbox_gl_native, RegisterModule) diff --git a/platform/node/test/js/require.js b/platform/node/test/js/require.js new file mode 100644 index 00000000000..1528002c205 --- /dev/null +++ b/platform/node/test/js/require.js @@ -0,0 +1 @@ +var mbgl = require('../../../../lib/mapbox-gl-native');