-awakeFromNib is called whenever the receiver is awoken from a nib, or is used as the owner of a nib that is instantiated. Therefore, it may be called more than once on any given object.
What's happening: Document system is preparing an accessory view for the save panel, probably so it can offer a popup with a few different document types. The view is loaded from a nib, by the document, and so calls -awakeFromNib. Anyway, the fix: Don't use -awakeFromNib. -windowControllerDidLoadNib: sounds like it's a better match for your needs. Mike. On 1 Feb 2010, at 07:13, Half Activist wrote: > Hello, > In a NSDocument based application, my document class handles 3 > different kinds of documents, 1 as a viewer and 2 as an editor. > Actually, I wished it could handle the 2 types as an editor but here is > what happens: > When I only have 1 type everything is ok as you might already have > understood, but when I add the second type and I go into "Save As..." the app > crashes under Snow Leopard. > It all boils down to the point that this little popup that's added to > the panel to select the file type seems to be screwing everything up. > > What's happening: my document class "awakeFromNib" gets called when the > save panel is loaded, I pasted the callstrack below: > > #0 -[MyProjectDocument awakeFromNib] (self=0x100436c60, _cmd=0x7fff830614e0) > at /Users/devel/Work/Project/MyProjectDocument.m:371 > #1 0x00007fff82927959 in -[NSIBObjectData > nibInstantiateWithOwner:topLevelObjects:] () > #2 0x00007fff82925b49 in loadNib () > #3 0x00007fff8292525c in +[NSBundle(NSNibLoading) > _loadNibFile:nameTable:withZone:ownerBundle:] () > #4 0x00007fff82c93797 in -[NSDocument > _savePanelAccessoryViewForWritableTypes:defaultType:] () > #5 0x00007fff82c91192 in -[NSDocument _preparedSavePanelForOperation:] () > #6 0x00007fff82c9022b in -[NSDocument > _runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:] () > #7 0x00007fff82c8dcda in -[NSDocument > runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:] () > #8 0x00007fff82ab909a in -[NSApplication sendAction:to:from:] () > #9 0x00007fff82add602 in -[NSMenuItem _corePerformAction] () > #10 0x00007fff82add36c in -[NSCarbonMenuImpl > performActionWithHighlightingForItemAtIndex:] () > #11 0x00007fff82d600b8 in -[NSMenu _internalPerformActionForItemAtIndex:] () > #12 0x00007fff82c129d5 in -[NSCarbonMenuImpl > _carbonCommandProcessEvent:handlerCallRef:] () > #13 0x00007fff82abfb60 in NSSLMMenuEventHandler () > #14 0x00007fff83e48bd7 in DispatchEventToHandlers () > #15 0x00007fff83e48126 in SendEventToEventTargetInternal () > #16 0x00007fff83e65d49 in SendEventToEventTarget () > #17 0x00007fff83e94d45 in SendHICommandEvent () > #18 0x00007fff83ec1a1a in SendMenuCommandWithContextAndModifiers () > #19 0x00007fff83ec19d4 in SendMenuItemSelectedEvent () > #20 0x00007fff83ec18dc in FinishMenuSelection () > #21 0x00007fff83ea2cf9 in MenuSelectCore () > #22 0x00007fff83ea2461 in _HandleMenuSelection2 () > #23 0x00007fff82990b79 in _NSHandleCarbonMenuEvent () > #24 0x00007fff829646a2 in _DPSNextEvent () > #25 0x00007fff82963b41 in -[NSApplication > nextEventMatchingMask:untilDate:inMode:dequeue:] () > #26 0x00007fff82929747 in -[NSApplication run] () > #27 0x00007fff82922468 in NSApplicationMain () > #28 0x000000010000172d in main (argc=1, argv=0x7fff5fbff7c0) at > /Users/devel/Work/Project/main.m:15 > > Maybe should I report this bug to Apple? > Regards._______________________________________________ > > Cocoa-dev mailing list ([email protected]) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net > > This email sent to [email protected] _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
