Re: Closing window on Yosemite crashes (isFlipped)

2014-11-06 Thread Allan Odgaard

On 6 Nov 2014, at 23:40, Graham Cox wrote:

Looks like an object is not removing itself as an observer of window 
notifications prior to deallocation […]


The crash happens when I re-use the window with the WebView, i.e. no 
(major) objects are released.


The crash (almost) disappeared when I started to release the window (and 
the contained WebView) and then re-create it the next time it was needed 
(rather than just orderOut/orderFront the window).

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Closing window on Yosemite crashes (isFlipped)

2014-11-06 Thread Graham Cox
Looks like an object is not removing itself as an observer of window 
notifications prior to deallocation. The notification center holds on to weak 
references, so these can become stale if not purposely removed, usually by a 
call to -removeObserver: as part of the -dealloc method (with ARC you would 
still need a -dealloc method, just not call [super dealloc]). But dealloc might 
be too late anyway.

With a bunch of related objects, such as a document, a window and the views in 
it, the exact order of destruction can mean that correctly untangling things 
from the notification center becomes tricky, and also may change from one OS 
release to another. Forgetting to -removeObserver: (or doing it in the wrong 
place) might work due to destruction order, then crash in a different OS 
version. I've run into this a few times. Usually finding where I'm calling 
-removeObserver: and making that happen earlier has led to a solution.

--Graham





On 31 Oct 2014, at 3:26 am, Fritz Anderson  wrote:

>> Application Specific Information:
>>  objc_msgSend() selector name: isFlipped
>>  Performing @selector(_close:) from sender _NSThemeCloseWidget 
>> 0x6119c560
>> 
>>  Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
>>  0   libobjc.A.dylib  0x7fff897530dd objc_msgSend + 29
>>  1   com.apple.AppKit 0x7fff8afb7d79 -[NSView 
>> convertRect:toView:] + 212
>>  2   com.apple.AppKit 0x7fff8b094b0e -[NSView(NSInternal) 
>> _updateLayerTreeRenderer] + 935
>>  3   com.apple.AppKit 0x7fff8b1c1548 -[NSView(NSInternal) 
>> _pauseLayerTreeRenderer] + 144
>>  4   com.apple.CoreFoundation 0x7fff830bacbc 
>> __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
>>  5   com.apple.CoreFoundation 0x7fff82fac1b4 _CFXNotificationPost + 
>> 3140
>>  6   com.apple.Foundation 0x7fff903acea1 -[NSNotificationCenter 
>> postNotificationName:object:userInfo:] + 66
>>  7   com.apple.AppKit 0x7fff8b0c70f4 -[NSWindow 
>> _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 4151


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Closing window on Yosemite crashes (isFlipped)

2014-11-06 Thread Allan Odgaard

On 30 Oct 2014, at 17:26, Fritz Anderson wrote:

I haven’t encountered this myself. This is stream-of-consciousness, 
adding the presence of convertRect:toView: in the trace as the 
immediate caller…


Thanks for your thoughts on the issue.

I haven’t pinpointed the exact cause of the crash, but I have learned 
that majority of the time, the crash happens if the window contains a 
WebView and that window has been previously closed (more than once).


So as a workaround I now recreate the window once it has been closed, 
rather than re-use it, and since I did this, I have only seen two 
crashes related to the isFlipped: (compared to thousdands from earlier 
versions).

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Closing window on Yosemite crashes (isFlipped)

2014-10-30 Thread Fritz Anderson
I haven’t encountered this myself. This is stream-of-consciousness, adding the 
presence of convertRect:toView: in the trace as the immediate caller…

…

The classic cause of a message arriving at the wrong object is that the 
expected object had been deallocated and its address recycled for the object 
that eventually got the bad call. The bad call comes of the calling object’s 
keeping an orphan pointer to the original.

I’d think ARC would make that very rare, but maybe not impossible, especially 
if the orphan pointer were unsafe_unretained. It’s too bad you don’t have a 
reproducible case; if there were one, I’d use the Allocations and Leaks 
instruments, with Allocations set to record the complete 
malloc/retain/release/free life cycles.

…

It’s worse in that if it is an orphan pointer, it smells as if it was kept in 
the view hierarchy of a framework-managed object. 

…

I wonder if _NSThemeCloseWidget is an NSCell; a cell wouldn’t implement any of 
those messages, assuming the subclass doesn’t add them. From the selectors you 
mention (plus the caller being inside convertRect:**toView:**), the caller 
seems to expect an NSView.

— F

> On 30 Oct 2014, at 9:59 AM, Allan Odgaard  wrote:
> 
> Since Yosemite I have seen a lot of crash reports submitted where the crash 
> is triggered by closing a window and it mostly ends with sending `isFlipped`, 
> `_isLayerBacked`, or `transformRect:` to a wrong object.


>   Application Specific Information:
>   objc_msgSend() selector name: isFlipped
>   Performing @selector(_close:) from sender _NSThemeCloseWidget 
> 0x6119c560
> 
>   Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
>   0   libobjc.A.dylib  0x7fff897530dd objc_msgSend + 29
>   1   com.apple.AppKit 0x7fff8afb7d79 -[NSView 
> convertRect:toView:] + 212
>   2   com.apple.AppKit 0x7fff8b094b0e -[NSView(NSInternal) 
> _updateLayerTreeRenderer] + 935
>   3   com.apple.AppKit 0x7fff8b1c1548 -[NSView(NSInternal) 
> _pauseLayerTreeRenderer] + 144
>   4   com.apple.CoreFoundation 0x7fff830bacbc 
> __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
>   5   com.apple.CoreFoundation 0x7fff82fac1b4 _CFXNotificationPost + 
> 3140
>   6   com.apple.Foundation 0x7fff903acea1 -[NSNotificationCenter 
> postNotificationName:object:userInfo:] + 66
>   7   com.apple.AppKit 0x7fff8b0c70f4 -[NSWindow 
> _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 4151
>   8   com.apple.AppKit 0x7fff8b0c5e17 -[NSWindow 
> _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 829
>   9   com.apple.AppKit 0x7fff8b0c5a6b -[NSWindow 
> orderWindow:relativeTo:] + 159
>   10  com.apple.AppKit 0x7fff8b1bf587 __18-[NSWindow 
> _close]_block_invoke + 444
>   11  com.apple.AppKit 0x7fff8b1bf395 -[NSWindow _close] + 363
>   12  com.apple.AppKit 0x7fff8b1bf145 -[NSWindow __close] + 
> 312
>   13  libsystem_trace.dylib0x7fff8fc41cd7 _os_activity_initiate + 
> 75
>   14  com.apple.AppKit 0x7fff8b1765e7 -[NSApplication 
> sendAction:to:from:] + 410
>   15  com.apple.AppKit 0x7fff8b176410 -[NSControl 
> sendAction:to:] + 86
>   16  com.apple.AppKit 0x7fff8b34adaf __26-[NSCell 
> _sendActionFrom:]_block_invoke + 131
>   17  libsystem_trace.dylib0x7fff8fc41cd7 _os_activity_initiate + 
> 75
>   18  com.apple.AppKit 0x7fff8b1bef2c -[NSCell 
> _sendActionFrom:] + 144
>   19  com.apple.AppKit 0x7fff8b331ab2 -[NSButtonCell 
> _sendActionFrom:] + 39
>   20  libsystem_trace.dylib0x7fff8fc41cd7 

...


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Closing window on Yosemite crashes (isFlipped)

2014-10-30 Thread Allan Odgaard
Since Yosemite I have seen a lot of crash reports submitted where the 
crash is triggered by closing a window and it mostly ends with sending 
`isFlipped`, `_isLayerBacked`, or `transformRect:` to a wrong object.


I have attached a sample crash report below.

Does anyone else see this? Anyone know what could cause it? Any hints on 
what I could do to debug it?


I haven’t been able to reproduce a similar crash in my own test 
environment, so any debugging would need to be done by deploying test 
builds with debug code.


Application Specific Information:
objc_msgSend() selector name: isFlipped
	Performing @selector(_close:) from sender _NSThemeCloseWidget 
0x6119c560


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib  0x7fff897530dd objc_msgSend + 29
	1   com.apple.AppKit 0x7fff8afb7d79 -[NSView 
convertRect:toView:] + 212
	2   com.apple.AppKit 0x7fff8b094b0e -[NSView(NSInternal) 
_updateLayerTreeRenderer] + 935
	3   com.apple.AppKit 0x7fff8b1c1548 -[NSView(NSInternal) 
_pauseLayerTreeRenderer] + 144
	4   com.apple.CoreFoundation 0x7fff830bacbc 
__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
	5   com.apple.CoreFoundation 0x7fff82fac1b4 _CFXNotificationPost + 
3140
	6   com.apple.Foundation 0x7fff903acea1 -[NSNotificationCenter 
postNotificationName:object:userInfo:] + 66
	7   com.apple.AppKit 0x7fff8b0c70f4 -[NSWindow 
_reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 
4151
	8   com.apple.AppKit 0x7fff8b0c5e17 -[NSWindow 
_doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 829
	9   com.apple.AppKit 0x7fff8b0c5a6b -[NSWindow 
orderWindow:relativeTo:] + 159
	10  com.apple.AppKit 0x7fff8b1bf587 __18-[NSWindow 
_close]_block_invoke + 444
	11  com.apple.AppKit 0x7fff8b1bf395 -[NSWindow _close] + 
363
	12  com.apple.AppKit 0x7fff8b1bf145 -[NSWindow __close] + 
312
	13  libsystem_trace.dylib0x7fff8fc41cd7 _os_activity_initiate + 
75
	14  com.apple.AppKit 0x7fff8b1765e7 -[NSApplication 
sendAction:to:from:] + 410
	15  com.apple.AppKit 0x7fff8b176410 -[NSControl 
sendAction:to:] + 86
	16  com.apple.AppKit 0x7fff8b34adaf __26-[NSCell 
_sendActionFrom:]_block_invoke + 131
	17  libsystem_trace.dylib0x7fff8fc41cd7 _os_activity_initiate + 
75
	18  com.apple.AppKit 0x7fff8b1bef2c -[NSCell 
_sendActionFrom:] + 144
	19  com.apple.AppKit 0x7fff8b331ab2 -[NSButtonCell 
_sendActionFrom:] + 39
	20  libsystem_trace.dylib0x7fff8fc41cd7 _os_activity_initiate + 
75
	21  com.apple.AppKit 0x7fff8b1d9a66 -[NSCell 
trackMouse:inRect:ofView:untilMouseUp:] + 2731
	22  com.apple.AppKit 0x7fff8b1d8cc1 -[NSButtonCell 
trackMouse:inRect:ofView:untilMouseUp:] + 491
	23  com.apple.AppKit 0x7fff8b1d8289 -[NSControl mouseDown:] 
+ 714
	24  com.apple.AppKit 0x7fff8b660e5d -[_NSThemeWidget 
mouseDown:] + 315
	25  com.apple.AppKit 0x7fff8b6d1fef -[NSWindow 
_reallySendEvent:] + 12827
	26  com.apple.AppKit 0x7fff8b15c65c -[NSWindow sendEvent:] 
+ 368
	27  com.apple.AppKit 0x7fff8b10e1e6 -[NSApplication 
sendEvent:] + 2238
	28  com.apple.AppKit 0x7fff8af9afe8 -[NSApplication run] + 
711
	29  com.apple.AppKit 0x7fff8af86424 NSApplicationMain + 
1832

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com