Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I tell which object is retaining my window?




On Jul 30, 2006, at 7:40 AM, email@hidden wrote:

I've got an application that was working fine until today, and now one of the temporary windows I create is being retained. A lot.

Sample log, after I subclassed the retain and release methods to do logging:
2006-07-30 15:28:54.349 Flix[2674] DashboardWindow retained: 1
2006-07-30 15:28:54.359 Flix[2674] DashboardWindow released: 2
2006-07-30 15:28:54.367 Flix[2674] DashboardWindow retained: 1
2006-07-30 15:28:54.376 Flix[2674] DashboardWindow released: 2
2006-07-30 15:28:54.388 Flix[2674] DashboardWindow retained: 1
2006-07-30 15:28:54.406 Flix[2674] DashboardWindow retained: 2
2006-07-30 15:28:54.415 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.423 Flix[2674] DashboardWindow released: 4
2006-07-30 15:28:54.433 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.441 Flix[2674] DashboardWindow released: 4
2006-07-30 15:28:54.452 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.461 Flix[2674] DashboardWindow released: 4
2006-07-30 15:28:54.470 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.479 Flix[2674] DashboardWindow released: 4
2006-07-30 15:28:54.488 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.497 Flix[2674] DashboardWindow released: 4
2006-07-30 15:28:54.506 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.515 Flix[2674] DashboardWindow released: 4
2006-07-30 15:28:54.523 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.524 Flix[2674] DashboardWindow released: 4


And so on. I'm creating the window in code like so:
			floatingWindow = [[[DashboardWindow alloc] init] retain];
And later, releasing it normally:
			[floatingWindow release];

So, as far as I can tell - something else is sending retain messages to my window.

Look like that something is your very own code...

floatingWindow = [[[DashboardWindow alloc] init] retain];

Taking that apart...

[[DashboardWindow alloc] init]

...will return you an object that is retained (owned) by you and hence you must send it a release message when you are done with it. Then you proceed to send it a retain message which adds one more retain to it and hence you must send another release to balance that retain.


-Shawn


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Can I tell which object is retaining my window? (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.