From 1060bf921d36cdf01c8a9792883cf3f97c10f92b Mon Sep 17 00:00:00 2001 From: YouJia Date: Tue, 21 Feb 2017 14:48:15 +0800 Subject: [PATCH 1/4] Update nedb_proxy.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 内存泄漏 --- node_modules/nedb_proxy.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/node_modules/nedb_proxy.js b/node_modules/nedb_proxy.js index 2733ad57..0050b631 100644 --- a/node_modules/nedb_proxy.js +++ b/node_modules/nedb_proxy.js @@ -24,13 +24,12 @@ function DBProxy(dbname) { this.dbname = dbname; }; -var token = 1; +var token = 0; var token2Callback = {}; DBProxy.prototype.send = function(params, callback, method) { - token++; var m = { - token: token, + token: ++token, method: method, dbname: this.dbname, // 转为json字符串, 如果{[a], [a]}, 在main接收后变成了 {[a], [null]}, 对象引用问题 @@ -84,6 +83,7 @@ DBProxy.prototype.remove = function (params, callback) { ipc.on('db-exec-ret', function(event, m) { var token = m.token; var callback = token2Callback[token]; + delete token2Callback[token]; // console.log('clent 接收到消息'); // console.log(m); // console.log('--------------'); @@ -93,4 +93,4 @@ ipc.on('db-exec-ret', function(event, m) { callback && callback(m.err, m.ret); }); -module.exports = DBProxy; \ No newline at end of file +module.exports = DBProxy; From ef6355a7475ec64f5ad9ddefed88248d38c5340c Mon Sep 17 00:00:00 2001 From: YouJia Date: Fri, 24 Feb 2017 04:21:00 +0000 Subject: [PATCH 2/4] Update lang.js bugfix --- public/js/lang.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/lang.js b/public/js/lang.js index 5fc4f7ff..94a2cd7c 100644 --- a/public/js/lang.js +++ b/public/js/lang.js @@ -23,7 +23,7 @@ var lang = { } var curLang = Config['lang'] || sysLang || defaultLang; - langData = me.readJson('public/langs/' + curLang + '.js'); + var langData = me.readJson('public/langs/' + curLang + '.js'); if(!langData) { langData = me.readJson('public/langs/' + defaultLang + '.js'); if (!langData) { @@ -67,4 +67,4 @@ var lang = { } }; -lang.init(); \ No newline at end of file +lang.init(); From ee9db43da26c7c6566af365ad1be3beaa9055952 Mon Sep 17 00:00:00 2001 From: YouJia Date: Fri, 24 Feb 2017 04:35:53 +0000 Subject: [PATCH 3/4] Update note.js bugfix --- public/js/app/note.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/public/js/app/note.js b/public/js/app/note.js index 77635e50..18a5761d 100644 --- a/public/js/app/note.js +++ b/public/js/app/note.js @@ -903,7 +903,7 @@ Note.renderChangedNote = function(changedNote) { $leftNoteNav.find(".desc").html(trimTitle(changedNote.Desc)); } if (changedNote.ImgSrc) { - $thumb = $leftNoteNav.find(".item-thumb"); + var $thumb = $leftNoteNav.find(".item-thumb"); // 有可能之前没有图片 if ($thumb.length > 0) { $thumb.find("img").attr("src", Note.fixImageSrc(changedNote.ImgSrc)); @@ -2500,8 +2500,6 @@ Note.initContextmenu = function() { this.menu.append(this.exports); } - T = this; - this.enable = function(name, ok) { this[name].enabled = ok; } From 52a440ea82ce4656c7a3705b78de821825e29414 Mon Sep 17 00:00:00 2001 From: YouJia Date: Fri, 24 Feb 2017 04:40:29 +0000 Subject: [PATCH 4/4] Update page.js bugfix --- public/js/app/page.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/app/page.js b/public/js/app/page.js index 8f881617..d5237d5e 100644 --- a/public/js/app/page.js +++ b/public/js/app/page.js @@ -1037,7 +1037,7 @@ LeaAce = { return true; } else { // 找到父是pre - $pre = $node.closest("pre"); + var $pre = $node.closest("pre"); if ($pre.length == 0) { return false; } @@ -1061,7 +1061,7 @@ LeaAce = { return false; } else { // 找到父是pre - $pre = $node.closest("pre"); + var $pre = $node.closest("pre"); if ($pre.length == 0) { return false; }