From 7de7c78150c6f6a127a916f04e3b2452a7d09069 Mon Sep 17 00:00:00 2001 From: Max Holtzberg Date: Sat, 9 Mar 2013 21:07:11 +0100 Subject: [PATCH] Increment reference count to prevent garbage collection --- node_modules/bonescript/misc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node_modules/bonescript/misc.cpp b/node_modules/bonescript/misc.cpp index b0c53c34..eab03991 100644 --- a/node_modules/bonescript/misc.cpp +++ b/node_modules/bonescript/misc.cpp @@ -91,6 +91,9 @@ class Pollpri: ObjectWrap { p->path = (char *)malloc(path.length() + 1); strncpy(p->path, *path, path.length() + 1); + // Increment reference count to prevent garbage collection + p->Ref(); + // Open file to watch int fd = open(p->path, O_RDWR | O_NONBLOCK); PRINTF("open(%s) returned %d: %s\n", p->path, fd, strerror(errno));