Skip to content

Commit

Permalink
Unset weak status of compiled scripts from Node
Browse files Browse the repository at this point in the history
Compiled scripts from Node were set to weak, which caused the script
object in V8 being GCed shortly. Hence links of the script shown in
console of DevTools become invalid after GC.

Fixed nwjs/nw.js#4269
  • Loading branch information
Cong Liu committed Mar 28, 2016
1 parent 5c8f26b commit d718ae7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,10 @@ class ContextifyScript : public BaseObject {
ContextifyScript(Environment* env, Local<Object> object)
: BaseObject(env, object) {
MakeWeak<ContextifyScript>(this);
// Unset weak of compiled script to survival from GC for Node modules.
// Otherwise the links from console will be invalid shortly.
// See https://github.com/nwjs/nw.js/issues/4269
ClearWeak();
}


Expand Down

0 comments on commit d718ae7

Please sign in to comment.