Fix crash on Mac with Touch Bar

This commit is contained in:
1024jp 2017-03-02 20:34:19 +09:00
parent ac1c100352
commit ee47729990
4 changed files with 47 additions and 7 deletions

View File

@ -2,6 +2,15 @@
Change Log
==========================
3.1.7 (188)
--------------------------
### Fixes
- Fix an issue on MacBook Pro with Touch Bar where the application crashed immediately after launch.
3.1.6 (186)
--------------------------

View File

@ -22,6 +22,23 @@
<h1>Release Notes</h1>
<article>
<header>
<h1>CotEditor 3.1.7</h1>
<p>release: <time>2016-03-03</time></p>
</header>
<section>
<h3>Fixes</h3>
<ul>
<li>Fix an issue on MacBook Pro with Touch Bar where the application crashed immediately after launch.</li>
</ul>
</section>
</article>
<article>
<header>
<h1>CotEditor 3.1.6</h1>

View File

@ -22,6 +22,23 @@
<h1>リリースノート</h1>
<article>
<header>
<h1>CotEditor 3.1.7</h1>
<p>リリース: <time>2016-03-03</time></p>
</header>
<section>
<h3>Fixes</h3>
<ul>
<li>Touch Bar の付いた MacBook Pro で起動直後にアプリケーションがクラッシュする不具合を修正しました。</li>
</ul>
</section>
</article>
<article>
<header>
<h1>CotEditor 3.1.6</h1>

View File

@ -218,14 +218,11 @@ extension NSCustomTouchBarItem: NSValidatedUserInterfaceItem {
let validator = NSApp.target(forAction: action, to: control.target, from: self)
else { return }
switch validator {
case let validator as TouchBarItemValidations:
// ! DO NOT use `swich ... case let` to classify. It causes crash.
if let validator = validator as? TouchBarItemValidations {
control.isEnabled = validator.validateTouchBarItem(self)
case let validator as NSUserInterfaceValidations:
control.isEnabled = validator.validateUserInterfaceItem(self)
default: break
} else if let validator = validator as? NSUserInterfaceValidations {
control.isEnabled = (validator as AnyObject).validateUserInterfaceItem(self)
}
}