Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Commit

Permalink
Fix #104: Avoid app termination unexpectedly on Linux
Browse files Browse the repository at this point in the history
- Wrap triggers of internal command with setTimeout
- Set cancelId as "Cancel" command
  • Loading branch information
yhatt committed Oct 31, 2016
1 parent b461f09 commit 22e9ea5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions coffee/classes/mds_window.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,18 @@ module.exports = class MdsWindow
title: 'Marp'
message: 'Are you sure?'
detail: "#{@getShortPath()} has been modified. Do you want to save the changes?"
cancelId: 2
, (result) =>
switch result
when 0 then @trigger 'save', 'forceClose'
when 1 then @trigger 'forceClose'
when 0
# Wrap by setTimeout to avoid app termination unexpectedly on Linux.
setTimeout =>
@trigger 'save', 'forceClose'
, 0
when 1
setTimeout =>
@trigger 'forceClose'
, 0
else
MdsWindow.appWillQuit = false

Expand Down

0 comments on commit 22e9ea5

Please # to comment.