Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #12056 from atom/crashreporter-not-on-ui-thread-ex…
Browse files Browse the repository at this point in the history
…cept-mac

CrashReporter should not run on UI thread on Win/Linux
  • Loading branch information
damieng committed Jun 28, 2016
2 parents c756a88 + 22922de commit df22e0b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
13 changes: 13 additions & 0 deletions src/crash-reporter-start.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = (extra) ->
# Breakpad on Mac OS X must be running on UI and non-UI processes
# Crashpad on Windows and Linux should only be running on non-UI process
return if process.type is 'renderer' and process.platform isnt 'darwin'

{crashReporter} = require 'electron'

crashReporter.start({
productName: 'Atom',
companyName: 'GitHub',
submitURL: 'http://54.249.141.255:1127/post'
extra: extra
})
7 changes: 4 additions & 3 deletions src/initialize-test-window.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ cloneObject = (object) ->
clone

module.exports = ({blobStore}) ->
{crashReporter, remote} = require 'electron'
# Start the crash reporter before anything else.
crashReporter.start(productName: 'Atom', companyName: 'GitHub', submitURL: 'http://54.249.141.255:1127/post')
startCrashReporter = require('./crash-reporter-start')
{remote} = require 'electron'

startCrashReporter() # Before anything else

exitWithStatusCode = (status) ->
remote.app.emit('will-quit')
Expand Down
8 changes: 3 additions & 5 deletions src/main-process/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ process.on 'uncaughtException', (error={}) ->
console.log(error.message) if error.message?
console.log(error.stack) if error.stack?

{crashReporter, app} = require 'electron'
{app} = require 'electron'
fs = require 'fs-plus'
path = require 'path'
temp = require 'temp'
yargs = require 'yargs'
previousConsoleLog = console.log
startCrashReporter = require('../crash-reporter-start')
console.log = require 'nslog'

start = ->
Expand Down Expand Up @@ -38,7 +39,7 @@ start = ->

app.on 'open-file', addPathToOpen
app.on 'open-url', addUrlToOpen
app.on 'will-finish-launching', setupCrashReporter
app.on 'will-finish-launching', startCrashReporter

if args.userDataDir?
app.setPath('userData', args.userDataDir)
Expand Down Expand Up @@ -66,9 +67,6 @@ handleStartupEventWithSquirrel = ->
squirrelCommand = process.argv[1]
SquirrelUpdate.handleStartupEvent(app, squirrelCommand)

setupCrashReporter = ->
crashReporter.start(productName: 'Atom', companyName: 'GitHub', submitURL: 'http://54.249.141.255:1127/post')

setupAtomHome = ({setPortable}) ->
return if process.env.ATOM_HOME

Expand Down
13 changes: 4 additions & 9 deletions static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,10 @@
ModuleCache.register(loadSettings)
ModuleCache.add(loadSettings.resourcePath)

// Start the crash reporter before anything else.
require('electron').crashReporter.start({
productName: 'Atom',
companyName: 'GitHub',
submitURL: 'http://54.249.141.255:1127/post',
// By explicitly passing the app version here, we could save the call
// of "require('remote').require('app').getVersion()".
extra: {_version: loadSettings.appVersion}
})
// By explicitly passing the app version here, we could save the call
// of "require('remote').require('app').getVersion()".
var startCrashReporter = require('../src/crash-reporter-start')
startCrashReporter({_version: loadSettings.appVersion})

setupVmCompatibility()
setupCsonCache(CompileCache.getCacheDirectory())
Expand Down

0 comments on commit df22e0b

Please sign in to comment.