Skip to content

Commit d609670

Browse files
author
Isaac Wagner
committed
HashTable's destructor will properly dispose of persistent handles
1 parent adb1eb1 commit d609670

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/hashtable.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ HashTable::HashTable() {}
2626

2727
HashTable::HashTable(size_t buckets) : map(buckets) {}
2828

29-
HashTable::~HashTable() {}
29+
HashTable::~HashTable() {
30+
for(auto itr = this->map.begin(); itr != this->map.end(); ) {
31+
Persistent<Value> value = itr->second;
32+
value.Dispose();
33+
34+
itr = this->map.erase(itr);
35+
}
36+
}
3037

3138
Handle<Value> HashTable::Constructor(const Arguments& args) {
3239
HashTable *obj;

0 commit comments

Comments
 (0)