[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Closing many windows with toolbars very slow



Dear All,

I tried asking this some time ago on cocoa-dev but got no answer.

When I close a lot of windows with toolbars in them (50+), the app 
spins around doing nothing visible after the last window is no longer 
visible. Profiling this section with Shark yields 90+ % spent doing 
this:

_CFXNotificationUnregister	CoreFoundation	
-[NSNotificationCenter removeObserver:name:object:]	Foundation
-[NSToolbar _destroyToolbarAssociation:]	AppKit	
-[NSToolbar _toolbarWillDeallocNotification:]	AppKit	
_nsnote_callback	Foundation	
__CFXNotificationPost	CoreFoundation	
_CFXNotificationPostNotification	CoreFoundation	
-[NSNotificationCenter postNotificationName:object:userInfo:]	Foundation
-[NSToolbar dealloc]	AppKit	
deallocAuxiliaryStorage	AppKit	
-[NSWindow dealloc]	AppKit

i.e. it spends 90+% in CFXNotificationUnregister, which is called 
mostly using the above call sequence, in reverse.

If I insert a

[[NSNotificationCenter defaultCenter] removeObserver: toolbar_]

in my ToolbarController dealloc, the spinning is greatly reduced.

So near as I can figure, the NSToolbar must be removing lots of 
notifications before going away.

Any suggestions about what I can do to improve the situation? (I'm 
uncomfortable with the removeObserver: kludge I used since the 
messaging could be important to the system.)



Cheers, Glen Low


---
pixelglow software | simply brilliant stuff
www.pixelglow.com