Skip to content

Commit 53bdd55

Browse files
author
Vinay Pulim
committed
Fixed bug that causes the BSON constructor to overwrite the native EventEmitter constructor
1 parent 092f4f2 commit 53bdd55

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

external-libs/bson/bson.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ static Handle<Value> VException(const char *msg) {
5454
return ThrowException(Exception::Error(String::New(msg)));
5555
};
5656

57+
Persistent<FunctionTemplate> BSON::constructor_template;
58+
5759
class MyExternal : public String::ExternalAsciiStringResource {
5860
public:
5961
MyExternal (char *d, size_t length) : ExternalAsciiStringResource() {

external-libs/bson/bson.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class BSON : public EventEmitter {
2222
static Handle<Value> ToLong(const Arguments &args);
2323
static Handle<Value> ToInt(const Arguments &args);
2424

25+
// Constructor used for creating new BSON objects from C++
26+
static Persistent<FunctionTemplate> constructor_template;
27+
2528
private:
2629
static Handle<Value> New(const Arguments &args);
2730
static Handle<Value> deserialize(char *data, bool is_array_item);
@@ -51,4 +54,4 @@ class BSON : public EventEmitter {
5154
static Handle<Value> decodeDBref(Local<Value> ref, Local<Value> oid, Local<Value> db);
5255
};
5356

54-
#endif // BSON_H_
57+
#endif // BSON_H_

0 commit comments

Comments
 (0)