-1

I've noticed that my app crashes if I:

  • Use custom Swift class for NSWindow
  • Add NSScrollView on the window
  • Running a specific target(I have 2 more in this project, and both of them works fine in the same conditions)

enter image description here

The code calling it looks like:

guard let alertWindow = alert.window else {//It crashes here
    //other code
    return false
}

Class implementation is empty. It's just NSWindow subclass(if I use NSWindow everything is ok)

class CustomAlertWindow: NSWindow {

}

It works fine with an empty Objective-C subclass

@interface CustomAlertWindow: NSWindow

@end

@implementation CustomAlertWindow

@end

Have someone faced such kind of crash. Looks like it tries to subscribe to NSScrollView events. And somewhy it fails. Probably something is wrong in my target, or perhaps it's just a Cocoa/XCode/etc. BUG...

I'm unable to reproduce it in an empty project at the moment, but I'll keep trying.

When I overloaded addObserver method, I discovered that keyPath is "contentLayoutRect"

override func addObserver(_ observer: NSObject, forKeyPath keyPath: String, options: NSKeyValueObservingOptions = [], context: UnsafeMutableRawPointer?) {
    super.addObserver(observer, forKeyPath: keyPath, options: options, context: context)
}

The same for both:

  • Swift 3
  • XCode Version 8.3.3 (8E3004b)
  • macOS: 10.12.5 (16F73)

and

  • Swift 3.2
  • Xcode Version 9.0 (9A235)
  • macOS: 10.13 (17A365)

P.S. Any way, thanks for attention.

Pratik Jamariya
  • 810
  • 1
  • 10
  • 35
Nuzhdin Vladimir
  • 1,714
  • 18
  • 36

1 Answers1

0

All problems were connected to the Sparkle.framework.

I've just updated it. We had all problems described in bug discussion.

Hope nobody face similar problems =)

We had Sparkle version 1.8.0 . I'm ashamed =(

Nuzhdin Vladimir
  • 1,714
  • 18
  • 36
  • Similar problem: [macOS 10.13 EXEC_BAD_ACCESS caused by subclassing NSTableView or NSScrollView](https://stackoverflow.com/questions/47140229/macos-10-13-exec-bad-access-caused-by-subclassing-nstableview-or-nsscrollview?noredirect=1#comment81273116_47140229). – Willeke Nov 09 '17 at 16:21