• 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
Release problem only on quit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Release problem only on quit


  • Subject: Release problem only on quit
  • From: Wdyp <email@hidden>
  • Date: Sun, 9 Dec 2007 00:58:23 +0100

Hi!

Here’s my problem:

I’ve got one window that like in a preferences window loads different views managed by subclasses of NSViewController.

One of those views has an NSTabView that loads different views also managed by a subclass of NSViewController, namely TabbedViewController.

When I switch to another view, the TabbedViewController instance gets deallocated, in dealloc I ask it to remove its view from the tabView then I send it a release message.

The problem is that if I just quit the app instead of switching to another tab, my app crashes.
It seems that the app’s terminate process first releases the tabView that releases its subview before my controller’s dealloc method gets a chance to deallocate. I happen to send a message to an object that doesn’t exist anymore.


Note that the situation was the same before I started using NSViewController. I hoped this new class would resolve this issue.
The only workaround is not to release the controller: it’s safe upon quitting but creates a leak when switching.


What do you think of this? Am I doing things the wrong way?

Thanks,

Flofl.

PS: This is the same in Apple’s ViewController sample: it is supposed to be a document-based app with New and Close commands even if it isn’t implemented and there’s no document controller. View controllers are allocated and released only when switching from one to another. If the doc and windows were closed by the user then the app would keep that controller allocated, as a leak…_______________________________________________

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: GC Drawer Madness
  • Next by Date: Re: GCC Standard Predefined Macros
  • Previous by thread: Re: GC Drawer Madness
  • Next by thread: String Encodings
  • Index(es):
    • Date
    • Thread