Fix crash when quitting
This commit is contained in:
parent
44651656dd
commit
f756a3e682
1 changed files with 3 additions and 3 deletions
|
@ -113,7 +113,7 @@ class TrackableObject : public TrackableObjectBase,
|
||||||
|
|
||||||
void AfterInit(v8::Isolate* isolate) override {
|
void AfterInit(v8::Isolate* isolate) override {
|
||||||
if (!weak_map_) {
|
if (!weak_map_) {
|
||||||
weak_map_.reset(new atom::KeyWeakMap<int32_t>);
|
weak_map_ = new atom::KeyWeakMap<int32_t>;
|
||||||
}
|
}
|
||||||
weak_map_id_ = ++next_id_;
|
weak_map_id_ = ++next_id_;
|
||||||
weak_map_->Set(isolate, weak_map_id_, Wrappable<T>::GetWrapper());
|
weak_map_->Set(isolate, weak_map_id_, Wrappable<T>::GetWrapper());
|
||||||
|
@ -123,7 +123,7 @@ class TrackableObject : public TrackableObjectBase,
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int32_t next_id_;
|
static int32_t next_id_;
|
||||||
static std::unique_ptr<atom::KeyWeakMap<int32_t>> weak_map_;
|
static atom::KeyWeakMap<int32_t>* weak_map_; // leaked on purpose
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(TrackableObject);
|
DISALLOW_COPY_AND_ASSIGN(TrackableObject);
|
||||||
};
|
};
|
||||||
|
@ -132,7 +132,7 @@ template<typename T>
|
||||||
int32_t TrackableObject<T>::next_id_ = 0;
|
int32_t TrackableObject<T>::next_id_ = 0;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
std::unique_ptr<atom::KeyWeakMap<int32_t>> TrackableObject<T>::weak_map_;
|
atom::KeyWeakMap<int32_t>* TrackableObject<T>::weak_map_ = nullptr;
|
||||||
|
|
||||||
} // namespace mate
|
} // namespace mate
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue