Skip to content

Commit 63bfed6

Browse files
committed
fix another problem of unclean mainloop disposal; fix problem where only 1st level node.js packages where detected
1 parent 069eaf6 commit 63bfed6

File tree

2 files changed

+28
-23
lines changed

2 files changed

+28
-23
lines changed

mainloop/vvvv.mainloop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ var MainLoop = function(patch, frames_per_second) {
124124
}
125125

126126
this.requestEvaluate = function() {
127-
if (isIdle) {
127+
if (isIdle && !that.disposing) {
128128
this.stop();
129129
this.start();
130130
}

server.js

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ VVVVContext.init('./', 'full', function (vvvv) {
103103
if (req.command) {
104104
if (!edit_mode)
105105
return;
106-
console.log('receiving patch update for '+vvvv.Helpers.prepareFilePath(req.patch));
106+
//console.log('receiving patch update for '+vvvv.Helpers.prepareFilePath(req.patch));
107107
var patches = patch.executionContext.Patches[vvvv.Helpers.prepareFilePath(req.patch)];
108108
var i = patches.length;
109109
while (i--) {
@@ -173,42 +173,47 @@ VVVVContext.init('./', 'full', function (vvvv) {
173173
if (patch) patch.destroy();
174174
patch = undefined;
175175
mainloop.stop();
176+
mainloop.disposing = true;
176177
mainloop = undefined;
177178
console.log("Connection closed");
178179
})
179180
conn.on("error", function(err) {
180181
if (patch) patch.destroy();
181182
patch = undefined;
182183
if (mainloop) mainloop.stop();
184+
if (mainloop) mainloop.disposing = true;
183185
mainloop = undefined;
184186
console.log("Connection closed/reset");
185187
})
186188
}).listen(5001)
189+
});
187190

188-
if (argv.e && VVVVContext.name=='nodejs') {
189-
var npm = require('npm');
190-
console.log('Checking for installed Node.js packages ...')
191-
npm.load({loglevel: 'silent', depth: 0}, function(err) {
192-
if (err)
193-
console.log(err);
194-
else {
195-
npm.commands.list([], function(err, res) {
196-
if (err && err.indexOf("extraneous")!==0) {
197-
console.log('Fehler',err);
198-
return;
199-
}
200-
for (var package_name in res.dependencies) {
191+
// fetch and register installed node.js packages
192+
if (argv.e && VVVVContext.name=='nodejs') {
193+
var npm = require('npm');
194+
console.log('Checking for installed Node.js packages ...')
195+
npm.load({loglevel: 'silent', progress: false}, function(err) {
196+
if (err)
197+
console.log(err);
198+
else {
199+
npm.commands.list([], function(err, res) {
200+
if (err && err.indexOf("extraneous")!==0) {
201+
console.log(err);
202+
return;
203+
}
204+
(function registerDeps(p) {
205+
for (var package_name in p.dependencies) {
201206
VVVVContext.LoadedLibs[package_name] = true;
207+
registerDeps(p.dependencies[package_name]);
202208
}
203-
console.log('done.\n');
204-
})
205-
}
206-
})
207-
}
208-
209-
210-
});
209+
})(res);
210+
console.log('Node.js packages scanned. Ready if you are.\n');
211+
})
212+
}
213+
})
214+
}
211215

216+
// launch browser window in app mode
212217
if (argv.mode=='app') {
213218
var bl = require('james-browser-launcher');
214219
bl(function(err, launch) {

0 commit comments

Comments
 (0)