Make sure that zlib contexts are not garbage collected when busy
authorBen Noordhuis <info@bnoordhuis.nl>
Tue, 10 Jan 2012 19:54:40 +0000 (20:54 +0100)
committerBert Belder <bertbelder@gmail.com>
Tue, 10 Jan 2012 20:01:19 +0000 (21:01 +0100)
src/node_zlib.cc

index 952fc26788b9b8f892381caf7c982178fa4d13f1..b3b430f3d1b55653eb147dcdb5e94d111834d83a 100644 (file)
@@ -134,6 +134,7 @@ template <node_zlib_mode mode> class ZCtx : public ObjectWrap {
                   ZCtx<mode>::After);
 
     req_wrap->Dispatched();
+    ctx->Ref();
 
     return req_wrap->object_;
   }
@@ -191,6 +192,7 @@ template <node_zlib_mode mode> class ZCtx : public ObjectWrap {
 
     // delete the ReqWrap
     delete req_wrap;
+    ctx->Unref();
   }
 
   static Handle<Value>