mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Ensure addFilesPromise won't produce null pointers if the worker is terminated before it is finished.
This commit is contained in:
1 parent
bdbef3de9a
commit
59783847a7
1 file changed
+11
-2
@@ -977,12 +977,21 @@ define(function (require, exports, module) {
|
||||
* we know we will need to re-init it in any new project that is opened.
|
||||
*/
|
||||
function handleProjectClose() {
|
||||
if (_ternWorker) {
|
||||
function terminateWorker() {
|
||||
_ternWorker.terminate();
|
||||
_ternWorker = null;
|
||||
ternPromise = null;
|
||||
resolvedFiles = {};
|
||||
}
|
||||
|
||||
if (_ternWorker) {
|
||||
if (addFilesPromise) {
|
||||
// If we're in the middle of added files, don't terminate
|
||||
// until we're done or we might get NPEs
|
||||
addFilesPromise.done(terminateWorker).fail(terminateWorker);
|
||||
} else {
|
||||
terminateWorker();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.getBuiltins = getBuiltins;
|
||||
|
||||
Reference in new issue
Block a user