Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

Commit

Permalink
Fix segmentation fault (core dumped) bug on Linux (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
quanglam2807 authored May 27, 2020
1 parent c7e628e commit 9d4bb49
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 79 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"cli-truncate": "2.1.0",
"electron-is-dev": "1.2.0",
"electron-settings": "3.2.0",
"electron-updater": "4.3.2",
"electron-updater": "4.3.3",
"fs-extra": "9.0.0",
"menubar": "8.0.2"
},
"devDependencies": {
"@material-ui/core": "4.9.14",
"@material-ui/core": "4.10.0",
"@material-ui/icons": "4.9.1",
"babel-cli": "6.26.0",
"babel-preset-env": "1.7.0",
Expand All @@ -48,7 +48,7 @@
"del": "5.1.0",
"dotenv": "8.2.0",
"electron": "8.3.0",
"electron-builder": "22.6.1",
"electron-builder": "22.7.0",
"electron-notarize": "0.3.0",
"eslint": "6.8.0",
"eslint-config-airbnb": "18.1.0",
Expand All @@ -60,7 +60,7 @@
"greek-utils": "1.2.2",
"hangul-romanization": "1.0.0",
"hebrew-transliteration": "1.2.3",
"mocha": "7.1.2",
"mocha": "7.2.0",
"node-fetch": "2.6.0",
"pouchdb-browser": "7.2.1",
"pouchdb-quick-search": "1.3.0",
Expand Down
12 changes: 10 additions & 2 deletions public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
const {
BrowserWindow,
Menu,
Tray,
app,
clipboard,
globalShortcut,
ipcMain,
nativeImage,
nativeTheme,
} = require('electron');
const fs = require('fs');
Expand Down Expand Up @@ -83,10 +85,16 @@ if (!gotTheLock) {
const updaterEnabled = process.env.SNAP == null && !process.mas && process.platform !== 'win32';
const attachToMenubar = getPreference('attachToMenubar');
if (attachToMenubar) {
// setImage after Tray instance is created to avoid
// "Segmentation fault (core dumped)" bug on Linux
// https://github.com/electron/electron/issues/22137#issuecomment-586105622
// https://github.com/atomery/translatium/issues/164
const tray = new Tray(nativeImage.createEmpty());
// icon template is not supported on Windows & Linux
const iconPath = path.resolve(__dirname, 'images', process.platform === 'darwin' ? 'menubarTemplate.png' : 'menubar.png');
tray.setImage(iconPath);
mb = menubar({
index: REACT_PATH,
// icon template is not supported on Windows & Linux
icon: path.resolve(__dirname, 'images', process.platform === 'darwin' ? 'menubarTemplate.png' : 'menubar.png'),
preloadWindow: true,
browserWindow: {
alwaysOnTop: getPreference('alwaysOnTop'),
Expand Down
161 changes: 88 additions & 73 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1300,13 +1300,13 @@
"@types/istanbul-reports" "^1.1.1"
"@types/yargs" "^13.0.0"

"@material-ui/core@4.9.14":
version "4.9.14"
resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.9.14.tgz#4388f82cf94554cd3a935774fc12820f3c607a8a"
integrity sha512-71oYrOpInx5honJ9GzZlygPjmsFhn7Bui61/SWLJsPTkMnfvuZfU3qVqlEHjXyDsnZ+uKmLAIdsrOYnphJxxXw==
"@material-ui/core@4.10.0":
version "4.10.0"
resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.10.0.tgz#e214e8f7981ff7975a918404b94508418642e463"
integrity sha512-yVlHe4b8AaoiTHhCOZeszHZ+T2iHU5DncdMGeNcQaaaO+q/Qrq0hxP3iFzTbgjRWnWwftEVQL668GRxcPJVRaQ==
dependencies:
"@babel/runtime" "^7.4.4"
"@material-ui/styles" "^4.9.14"
"@material-ui/styles" "^4.10.0"
"@material-ui/system" "^4.9.14"
"@material-ui/types" "^5.1.0"
"@material-ui/utils" "^4.9.12"
Expand All @@ -1325,10 +1325,10 @@
dependencies:
"@babel/runtime" "^7.4.4"

"@material-ui/styles@^4.9.14":
version "4.9.14"
resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.9.14.tgz#0a9e93a2bf24e8daa0811411a6f3dabdafbe9a07"
integrity sha512-zecwWKgRU2VzdmutNovPB4s5LKI0TWyZKc/AHfPu9iY8tg4UoLjpa4Rn9roYrRfuTbBZHI6b0BXcQ8zkis0nzQ==
"@material-ui/styles@^4.10.0":
version "4.10.0"
resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.10.0.tgz#2406dc23aa358217aa8cc772e6237bd7f0544071"
integrity sha512-XPwiVTpd3rlnbfrgtEJ1eJJdFCXZkHxy8TrdieaTvwxNYj42VnnCyFzxYeNW9Lhj4V1oD8YtQ6S5Gie7bZDf7Q==
dependencies:
"@babel/runtime" "^7.4.4"
"@emotion/hash" "^0.8.0"
Expand Down Expand Up @@ -1573,10 +1573,10 @@
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==

"@types/fs-extra@^8.1.0":
version "8.1.0"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.0.tgz#1114834b53c3914806cd03b3304b37b3bd221a4d"
integrity sha512-UoOfVEzAUpeSPmjm7h1uk5MH6KZma2z2O7a75onTGjnNvAvMVrPzPL/vBbT65iIGHWj6rokwfmYcmxmlSf2uwg==
"@types/fs-extra@^9.0.1":
version "9.0.1"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-9.0.1.tgz#91c8fc4c51f6d5dbe44c2ca9ab09310bd00c7918"
integrity sha512-B42Sxuaz09MhC3DDeW5kubRcQ5by4iuVQ0cRRWM2lggLzAa/KVom0Aft/208NgMvNQQZ86s5rVcqDdn/SH0/mg==
dependencies:
"@types/node" "*"

Expand Down Expand Up @@ -2119,26 +2119,26 @@ app-builder-bin@3.5.9:
resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-3.5.9.tgz#a3ac0c25286bac68357321cb2eaf7128b0bc0a4f"
integrity sha512-NSjtqZ3x2kYiDp3Qezsgukx/AUzKPr3Xgf9by4cYt05ILWGAptepeeu0Uv+7MO+41o6ujhLixTou8979JGg2Kg==

app-builder-lib@22.6.1:
version "22.6.1"
resolved "https://registry.yarnpkg.com/app-builder-lib/-/app-builder-lib-22.6.1.tgz#f17bfbde1bbb26ae438e450b66005bf6714feb30"
integrity sha512-ENL7r+H7IBfDb4faeLASgndsXrAT7AV7m7yJjcpbFDXYma6an7ZWGFIvR0HJrsfiC5TIB8kdLJ/aMSImrrSi/Q==
app-builder-lib@22.7.0:
version "22.7.0"
resolved "https://registry.yarnpkg.com/app-builder-lib/-/app-builder-lib-22.7.0.tgz#ccd3e7ece2d46bc209423a77aa142f74aaf65db0"
integrity sha512-blRKwV8h0ztualXS50ciCTo39tbuDGNS+ldcy8+KLvKXuT6OpYnSJ7M6MSfPT+xWatshMHJV1rJx3Tl+k/Sn/g==
dependencies:
"7zip-bin" "~5.0.3"
"@develar/schema-utils" "~2.6.5"
async-exit-hook "^2.0.1"
bluebird-lst "^1.0.9"
builder-util "22.6.1"
builder-util-runtime "8.7.0"
builder-util "22.7.0"
builder-util-runtime "8.7.1"
chromium-pickle-js "^0.2.0"
debug "^4.1.1"
ejs "^3.1.2"
electron-publish "22.6.1"
debug "^4.2.0"
ejs "^3.1.3"
electron-publish "22.7.0"
fs-extra "^9.0.0"
hosted-git-info "^3.0.4"
is-ci "^2.0.0"
isbinaryfile "^4.0.6"
js-yaml "^3.13.1"
js-yaml "^3.14.0"
lazy-val "^1.0.4"
minimatch "^3.0.4"
normalize-package-data "^2.5.0"
Expand Down Expand Up @@ -3570,30 +3570,30 @@ buffer@~5.2.1:
base64-js "^1.0.2"
ieee754 "^1.1.4"

builder-util-runtime@8.7.0:
version "8.7.0"
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.7.0.tgz#e48ad004835c8284662e8eaf47a53468c66e8e8d"
integrity sha512-G1AqqVM2vYTrSFR982c1NNzwXKrGLQjVjaZaWQdn4O6Z3YKjdMDofw88aD9jpyK9ZXkrCxR0tI3Qe9wNbyTlXg==
builder-util-runtime@8.7.1:
version "8.7.1"
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.7.1.tgz#23c808cddd650d4376a7a1518ec1e80e85c10f00"
integrity sha512-uEBH1nAnTvzjcsrh2XI3qOzJ39h0+9kuIuwj+kCc3a07TZNGShfJcai8fFzL3mNgGjEFxoq+XMssR11r+FOFSg==
dependencies:
debug "^4.1.1"
debug "^4.2.0"
sax "^1.2.4"

builder-util@22.6.1:
version "22.6.1"
resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-22.6.1.tgz#78172c3634da460325277ef798994592e595eff3"
integrity sha512-A9cF+bSHqRTSKIUHEyE92Tl0Uh12N7yZRH9bccIL3gRUwtp6ulF28LsjNIWTSQ1clZo2M895cT5PCrKzjPQFVg==
builder-util@22.7.0:
version "22.7.0"
resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-22.7.0.tgz#0776a66e6d6e408a78bed7f17a7ad22516d9e7f0"
integrity sha512-UV3MKL0mwjMq2y9JlBf28Cegpj0CrIXcjGkO0TXn+QZ6Yy9rY6lHOuUvpQ19ct2Qh1o+QSwH3Q1nKUf5viJBBg==
dependencies:
"7zip-bin" "~5.0.3"
"@types/debug" "^4.1.5"
"@types/fs-extra" "^8.1.0"
"@types/fs-extra" "^9.0.1"
app-builder-bin "3.5.9"
bluebird-lst "^1.0.9"
builder-util-runtime "8.7.0"
builder-util-runtime "8.7.1"
chalk "^4.0.0"
debug "^4.1.1"
debug "^4.2.0"
fs-extra "^9.0.0"
is-ci "^2.0.0"
js-yaml "^3.13.1"
js-yaml "^3.14.0"
source-map-support "^0.5.19"
stat-mode "^1.0.0"
temp-file "^3.3.7"
Expand Down Expand Up @@ -4775,6 +4775,13 @@ debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
dependencies:
ms "^2.1.1"

debug@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.2.0.tgz#7f150f93920e94c58f5574c2fd01a3110effe7f1"
integrity sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==
dependencies:
ms "2.1.2"

decamelize@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
Expand Down Expand Up @@ -5004,16 +5011,16 @@ dir-glob@^3.0.1:
dependencies:
path-type "^4.0.0"

dmg-builder@22.6.1:
version "22.6.1"
resolved "https://registry.yarnpkg.com/dmg-builder/-/dmg-builder-22.6.1.tgz#5777a9eb6904db5bf1f4c69addbf462f5f9bf4e4"
integrity sha512-jUTN0acP15puzevtQASj7QEPgUGpedWSuSnOwR/++JbeYRTwU2oro09h/KZnaeMcxgxjdmT3tYLJeY1XUfPbRg==
dmg-builder@22.7.0:
version "22.7.0"
resolved "https://registry.yarnpkg.com/dmg-builder/-/dmg-builder-22.7.0.tgz#ead7e7c046cbdc52d29d302a4455f6668cdf7d45"
integrity sha512-5Ea2YEz6zSNbyGzZD+O9/MzmaXb6oa15cSKWo4JQ1xP4rorOpte7IOj2jcwYjtc+Los2gu1lvT314OC1OZIWgg==
dependencies:
app-builder-lib "22.6.1"
builder-util "22.6.1"
app-builder-lib "22.7.0"
builder-util "22.7.0"
fs-extra "^9.0.0"
iconv-lite "^0.5.1"
js-yaml "^3.13.1"
js-yaml "^3.14.0"
sanitize-filename "^1.6.3"

dns-equal@^1.0.0:
Expand Down Expand Up @@ -5191,25 +5198,25 @@ ee-first@1.1.1:
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=

ejs@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.2.tgz#a9986e6920a60f2a3229e87d4f0f3c073209874c"
integrity sha512-zFuywxrAWtX5Mk2KAuoJNkXXbfezpNA0v7i+YC971QORguPekpjpAgeOv99YWSdKXwj7JxI2QAWDeDkE8fWtXw==
ejs@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.3.tgz#514d967a8894084d18d3d47bd169a1c0560f093d"
integrity sha512-wmtrUGyfSC23GC/B1SMv2ogAUgbQEtDmTIhfqielrG5ExIM9TP4UoYdi90jLF1aTcsWCJNEO0UrgKzP0y3nTSg==
dependencies:
jake "^10.6.1"

electron-builder@22.6.1:
version "22.6.1"
resolved "https://registry.yarnpkg.com/electron-builder/-/electron-builder-22.6.1.tgz#9cc704356ecba1342ff1c94d610aad1f3c6a8b02"
integrity sha512-3/VNg9GfXKHM53TilFtfF1+bsAR8THK1XHgeqCpsiequa02J9jTPc/DhpCUKQPkrs6/EIGxP7uboop7XYoew0Q==
electron-builder@22.7.0:
version "22.7.0"
resolved "https://registry.yarnpkg.com/electron-builder/-/electron-builder-22.7.0.tgz#a42d08a1654ffc2f7d9e2860829d3cc55d4a0c81"
integrity sha512-t6E3oMutpST64YWbZCg7HodEwJOsnjUF1vnDIHm2MW6CFZPX8tlCK6efqaV66LU0E0Nkp/JH6TE5bCqQ1+VdPQ==
dependencies:
"@types/yargs" "^15.0.5"
app-builder-lib "22.6.1"
app-builder-lib "22.7.0"
bluebird-lst "^1.0.9"
builder-util "22.6.1"
builder-util-runtime "8.7.0"
builder-util "22.7.0"
builder-util-runtime "8.7.1"
chalk "^4.0.0"
dmg-builder "22.6.1"
dmg-builder "22.7.0"
fs-extra "^9.0.0"
is-ci "^2.0.0"
lazy-val "^1.0.4"
Expand All @@ -5236,15 +5243,15 @@ electron-positioner@^4.1.0:
resolved "https://registry.yarnpkg.com/electron-positioner/-/electron-positioner-4.1.0.tgz#e158f8f6aabd6725a8a9b4f2279b9504bcbea1b0"
integrity sha512-726DfbI9ZNoCg+Fcu6XLuTKTnzf+6nFqv7h+K/V6Ug7IbaPMI7s9S8URnGtWFCy5N5PL4HSzRFF2mXuinftDdg==

electron-publish@22.6.1:
version "22.6.1"
resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-22.6.1.tgz#d5381220d3e0f3bfa869c5a059fd253a561e0f8a"
integrity sha512-/MkS47ospdSfAFW5Jp52OzYou14HhGJpZ51uAc3GJ5rCfACeqpimC/n1ajRLE3hcXxTWfd3t9MCuClq5jrUO5w==
electron-publish@22.7.0:
version "22.7.0"
resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-22.7.0.tgz#d92ba7c4007c9ac1dd070593e48028184fb2dc19"
integrity sha512-hmU69xlb6vvAV3QfpHYDlkdZMFdBAgDbptoxbLFrnTq5bOkcL8AaDbvxeoZ4+lvqgs29NwqGpkHo2oN+p/hCfg==
dependencies:
"@types/fs-extra" "^8.1.0"
"@types/fs-extra" "^9.0.1"
bluebird-lst "^1.0.9"
builder-util "22.6.1"
builder-util-runtime "8.7.0"
builder-util "22.7.0"
builder-util-runtime "8.7.1"
chalk "^4.0.0"
fs-extra "^9.0.0"
lazy-val "^1.0.4"
Expand All @@ -5263,15 +5270,15 @@ electron-to-chromium@^1.3.378, electron-to-chromium@^1.3.413, electron-to-chromi
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.433.tgz#5e7da22eb852955f6b157596bdd89bee0fd5c73a"
integrity sha512-C0gcgwB8RpPAq2Ia6teihNOHOfNzGy4jJXgjIXSmKdt6O2xrJM8CPjA8jTFyo97KozVrZ8oH2FUCixC6Hnuk2g==

electron-updater@4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.3.2.tgz#a6de811f47c78dc99e3c4ffb89f40b453e30d334"
integrity sha512-nTXr4zd0NKD0JzV6WfZ+0RzzRIGlnvElrocjjjtEaEBI0k7hBRNR/53eg1YgdxlhFjOxFAjidCBXjum/VS5IzQ==
electron-updater@4.3.3:
version "4.3.3"
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.3.3.tgz#15d581793513e49646fe279c8f425a6b8259a064"
integrity sha512-Jas2owMS4qk1CVNZm+UoXcubKPVQUAp3xwKf059sbq6rKn/FgvgAtRjYy1SDfuyQOzDbjg1T3XbMr0xtNQg6bw==
dependencies:
"@types/semver" "^7.2.0"
builder-util-runtime "8.7.0"
builder-util-runtime "8.7.1"
fs-extra "^9.0.0"
js-yaml "^3.13.1"
js-yaml "^3.14.0"
lazy-val "^1.0.4"
lodash.isequal "^4.5.0"
semver "^7.3.2"
Expand Down Expand Up @@ -8199,6 +8206,14 @@ js-yaml@3.13.1, js-yaml@^3.13.1:
argparse "^1.0.7"
esprima "^4.0.0"

js-yaml@^3.14.0:
version "3.14.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482"
integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"

jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
Expand Down Expand Up @@ -9146,10 +9161,10 @@ mkdirp@0.5.5, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.4, mkdirp
dependencies:
minimist "^1.2.5"

mocha@7.1.2:
version "7.1.2"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-7.1.2.tgz#8e40d198acf91a52ace122cd7599c9ab857b29e6"
integrity sha512-o96kdRKMKI3E8U0bjnfqW4QMk12MwZ4mhdBTf+B5a1q9+aq2HRnj+3ZdJu0B/ZhJeK78MgYuv6L8d/rA5AeBJA==
mocha@7.2.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-7.2.0.tgz#01cc227b00d875ab1eed03a75106689cfed5a604"
integrity sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ==
dependencies:
ansi-colors "3.2.3"
browser-stdout "1.3.1"
Expand Down Expand Up @@ -9224,7 +9239,7 @@ ms@2.1.1:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==

ms@^2.1.1:
ms@2.1.2, ms@^2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
Expand Down

0 comments on commit 9d4bb49

Please sign in to comment.