Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-06-2010, 08:04 PM   #1 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 36
Default UISegmented control dealloc crash

I got a crash log from my user. The "top" part of the log looks like this:

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
Crashed Thread: 0

Thread 0 Crashed:
0 libobjc.A.dylib 0x000026f6 objc_msgSend + 18
1 UIKit 0x0011928c -[UISegmentedControl dealloc] + 12
2 CoreFoundation 0x00038f30 -[NSObject release] + 24
3 UIKit 0x00095c4c -[UIBarButtonItem dealloc] + 64
4 CoreFoundation 0x00038f30 -[NSObject release] + 24
5 UIKit 0x0008ec7a -[UINavigationItem dealloc] + 86
6 CoreFoundation 0x00038f30 -[NSObject release] + 24
7 UIKit 0x0009596c -[UIViewController dealloc] + 484
8 myApp 0x000041f6 -[myAppListViewController dealloc]

If I am reading this correctly, it has crashed trying to send a dealloc message to a segmented control (presumably the one I have on my navigation bar).

The relevant part of the segment control creation is:

NSString *strT = [self.dateformatUse stringFromDate:[NSDate date]];
NSString *strToday = [[[NSString alloc] initWithString:strT]autorelease];
NSArray *arSegments = [[NSArray alloc] initWithObjects:@"<",strToday,@">",nil];
UISegmentedControl *segctrlT = [[UISegmentedControl alloc] initWithItems:arSegments];
[arSegments release];
// set various segment control attributes
self.navigationItem.titleView = segctrlT;
self.segctrlTitle = segctrlT;
[segctrlT release];

in ViewDidUnload I have:

self.segctrlTitle = nil;

in dealloc for the view controller I have

[self.segctrlTitle release];

I am figuring either I shouldn't release (or rather should use autorelease) the components I use to build the segmented control in the creation part, or I shouldn't be setting it to nil in my ViewDidUnload routine. The crash is very elusive, so doing a "fix" and then testing it doesn't really work. I was hoping someone would see what I am doing wrong.
BrianMu is offline   Reply With Quote
Old 02-07-2010, 11:19 AM   #2 (permalink)
Will Work for Food!
 
itzdark's Avatar
 
Join Date: Apr 2009
Posts: 574
Send a message via AIM to itzdark Send a message via MSN to itzdark
Default

if you release it after you create it you dont need to release it again in the dealloc method.........
__________________

Check out my apps

Developers, check out study buddy. I use it everytime I code. It's great for those late night coding sessions.
Unofficial Ad Hoc Distribution Guide || Join my cooperative ad hoc testing group
iSoothe Promotional Video
Contact Me
itzdark is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,136
Threads: 38,911
Posts: 170,717
Top Poster: smasher (2,565)
Welcome to our newest member, cye
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:14 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0