Tracking rect assertions

Hi,


Anyone seen these assertions? I have not explicitly set any tracking rect in my app, yet get these when the app is launched. This is a Mac OS X app running on 10.9.5.


2015-06-27 07:49:02.238 MyApp[4759:303] *** Assertion failure in -[MyMainWindow _setTrackingRect:inside:owner:userData:useTrackingNum:install:], /SourceCache/AppKit/AppKit-1265.21/AppKit.subproj/NSWindow.m:5298

2015-06-27 07:49:02.238 MyApp[4759:303] Window: target of tracking rect doesnt understand -mouseEntered: or -mouseExited messages

2015-06-27 07:49:02.240 MyApp[4759:303] (

0 CoreFoundation 0x00007fff967a725c __exceptionPreprocess + 172

1 libobjc.A.dylib 0x00007fff95717e75 objc_exception_throw + 43

2 CoreFoundation 0x00007fff967a7038 +[NSException raise:format:arguments:] + 104

3 Foundation 0x00007fff8f919d41 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189

4 AppKit 0x00007fff8c528fcf -[NSWindow _setTrackingRect:inside:owner:userData:useTrackingNum:install:] + 578

5 AppKit 0x00007fff8c528d7a -[NSWindow _setTrackingRect:inside:owner:userData:useTrackingNum:] + 65

6 AppKit 0x00007fff8c528b40 -[NSView(NSInternal) _installTrackingArea:] + 409

7 AppKit 0x00007fff8c623761 -[NSView(NSInternal) _updateTrackingAreas] + 1199

8 AppKit 0x00007fff8c6238c7 -[NSView(NSInternal) _updateTrackingAreas] + 1557

9 AppKit 0x00007fff8c6238c7 -[NSView(NSInternal) _updateTrackingAreas] + 1557

10 AppKit 0x00007fff8c679e24 _handleInvalidCursorRectsNote + 994

11 AppKit 0x00007fff8cc578a1 __35-[NSWindow _postInvalidCursorRects]_block_invoke2988 + 46

12 CoreFoundation 0x00007fff966d7d67 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23

13 CoreFoundation 0x00007fff966d7cd7 __CFRunLoopDoObservers + 391

14 CoreFoundation 0x00007fff966c93b8 __CFRunLoopRun + 776

15 CoreFoundation 0x00007fff966c8e75 CFRunLoopRunSpecific + 309

16 HIToolbox 0x00007fff90540a0d RunCurrentEventLoopInMode + 226

17 HIToolbox 0x00007fff90540685 ReceiveNextEventCommon + 173

18 HIToolbox 0x00007fff905405bc _BlockUntilNextEventMatchingListInModeWithFilter + 65

19 AppKit 0x00007fff8c4dd24e _DPSNextEvent + 1434

20 AppKit 0x00007fff8c4dc89b -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122

21 AppKit 0x00007fff8c4d099c -[NSApplication run] + 553

22 AppKit 0x00007fff8c4bb783 NSApplicationMain + 940

23 MyApp 0x0000000100014ed8 main + 88

24 MyApp 0x00000001000094c4 start + 52

25 ??? 0x0000000000000003 0x0 + 3

)

Replies

Please file a bug report with this information. If you can include a sample project showing this that would be helpful.

I also encountered the same issue what is the fix ?

below is my code which i am adding button inside NSMenuItem.


let button = NSButton.init(frame: NSRect(x: 0, y: 0, width: 18, height: 18 ))
        button.isBordered = false
        button.focusRingType = .none
        button.image = NSImage(named:  NSImage.Name(rawValue: "arrow_down"))
        button.alternateImage = NSImage(named:  NSImage.Name(rawValue: "arrow_down"))
        button.image?.isTemplate = true
        button.alternateImage?.isTemplate = true
        button.imageScaling = .scaleProportionallyUpOrDown
        button.target = self
        button.sendAction(on: NSEvent.EventTypeMask.leftMouseDown)
        button.action = #selector(self.buttonClicked)
        self.statusMenu?.item(withTag: MenuItemTag.MenuItemTagMoreMenu.rawValue)?.view = button
        var rect = button.frame
        rect.size.width = (self.statusMenu?.size.width)!
        button.frame = rect

        let trackingArea = NSTrackingArea.init(rect: NSMakeRect(0, 0, 350, 18), options: NSTrackingArea.Options(rawValue: NSTrackingArea.Options.activeAlways.rawValue | NSTrackingArea.Options.mouseEnteredAndExited.rawValue) , owner: self, userInfo: nil)

        button.addTrackingArea(trackingArea)
ouseEnteredAndExited], owner: self, userInfo: nil)
        button.addTrackingArea(trackingArea)