• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDocument "save as" bug
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocument "save as" bug


  • Subject: Re: NSDocument "save as" bug
  • From: Gregory Weston <email@hidden>
  • Date: Mon, 01 Feb 2010 09:18:27 -0500

Half Activist wrote:

> On Feb 1, 2010, at 8:54 AM, Alexey Zakhlestin wrote:
>
>> On 01.02.2010, at 10: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
>>
>> this line clearly shows, that the bug is in your awakeFromNib method at line 371.
>> you should apply fix there
>>
>>> #1  0x00007fff82927959 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] ()
>>> #2  0x00007fff82925b49 in loadNib ()
>>> #3  0x00007fff8292525c in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] ()
>>
> Not at all!
> The bug comes from the fact that it is called twice, first when the document's nib is loaded (and everything is ok) and secondly when the panel opens in which case yes it crashes because initialization already took place and it shouldn't be called however.

What's the source of your confidence that it's not loading another copy of the nib? That certainly looks like what's happening based on the call stack.

Sounds like you might be making an assumption that only one copy of your document can exist (or at least only one at a time).


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Prev by Date: __weak references in non-GC
  • Next by Date: [iPhone] Implementing APN , push notification not received to iphone
  • Previous by thread: Re: NSDocument "save as" bug
  • Next by thread: Re: NSDocument "save as" bug
  • Index(es):
    • Date
    • Thread