mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
timers: fix unref() memory leak
The destructor isn't being called for timers that have been unref'd. Fixes: https://github.com/joyent/node/issues/8364 Signed-off-by: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
2
icu_config.gypi
Normal file
2
icu_config.gypi
Normal file
@@ -0,0 +1,2 @@
|
||||
# Do not edit. Generated by the configure script.
|
||||
{ 'variables': { }}
|
||||
@@ -290,6 +290,14 @@ var Timeout = function(after) {
|
||||
this._repeat = false;
|
||||
};
|
||||
|
||||
|
||||
function unrefdHandle() {
|
||||
this.owner._onTimeout();
|
||||
if (!this.owner.repeat)
|
||||
this.owner.close();
|
||||
}
|
||||
|
||||
|
||||
Timeout.prototype.unref = function() {
|
||||
if (!this._handle) {
|
||||
|
||||
@@ -303,7 +311,8 @@ Timeout.prototype.unref = function() {
|
||||
if (delay < 0) delay = 0;
|
||||
exports.unenroll(this);
|
||||
this._handle = new Timer();
|
||||
this._handle.ontimeout = this._onTimeout;
|
||||
this._handle.owner = this;
|
||||
this._handle.ontimeout = unrefdHandle;
|
||||
this._handle.start(delay, 0);
|
||||
this._handle.domain = this.domain;
|
||||
this._handle.unref();
|
||||
|
||||
Reference in New Issue
Block a user