Can a struct become deallocated?
Posted
by brettr
on Stack Overflow
See other posts from Stack Overflow
or by brettr
Published on 2010-04-19T00:14:50Z
Indexed on
2010/04/19
0:23 UTC
Read the original article
Hit count: 542
I've declared a struct in my header file like this:
typedef struct {
NSString *department;
NSString *departmentId;
} Department;
Department currentDepartment;
This struct is in a fairly simple class. I assign the struct values in viewDidLoad. Just before leaving viewDidLoad, I see the struct values are still there. After the user clicks a segment control, I reassign the struct values. Before assigning values, I see the two struct values are 0x0. I do have NSZombieEnabled, which is printing out this when I mouse over the struct while the app is running and one of my breakpoints have been hit:
MyApp[25722:207] *** -[CFString _cfTypeID]: message sent to deallocated instance 0xfc0e90
I'm not creating an instance of the struct or deallocating it. How can it be getting deallocated?
© Stack Overflow or respective owner