From d32f7b52a6a3250d480025b1499e05d0df783e7b Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Fri, 10 Jul 2015 14:56:32 -0500 Subject: [PATCH] serialize IPC to avoid duplicate reference nulling --- app/lib/muxrpc-ipc.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/lib/muxrpc-ipc.js b/app/lib/muxrpc-ipc.js index e3a4e87..4836916 100644 --- a/app/lib/muxrpc-ipc.js +++ b/app/lib/muxrpc-ipc.js @@ -26,6 +26,12 @@ module.exports = function (window, sbot, params) { var ipcPush = pushable() ipc.on('muxrpc-ssb', function (e, msg) { if (e.sender == window.webContents) { + try { + if (typeof msg == 'string') + msg = JSON.parse(msg) + } catch (e) { + return + } if (msg.bvalue) { msg.value = new Buffer(msg.bvalue, 'base64') delete msg.bvalue @@ -40,7 +46,7 @@ module.exports = function (window, sbot, params) { msg.bvalue = msg.value.toString('base64') delete msg.value } - window.webContents.send('muxrpc-ssb', msg) + window.webContents.send('muxrpc-ssb', JSON.stringify(msg)) }, function (err) { if (err) { console.error(err) } } ))