Re: What cause EXC_BAD_ACCESS?
Re: What cause EXC_BAD_ACCESS?
- Subject: Re: What cause EXC_BAD_ACCESS?
- From: Norio Ota <email@hidden>
- Date: Mon, 1 Oct 2007 11:23:26 +0900
Jerry, thanks and go see NSEnumerator documentation,
Fritz, thanks for your reply.
Here is the stack where SIGTRAP comes.
#0 0x90a619c1 in _objc_error
#1 0x90a619f8 in __objc_error
#2 0x90a60060 in _freedHandler
#3 0x927d88cf in NSPopAutoreleasePool
#4 0x93281e28 in -[NSApplication run]
#5 0x93275d2f in NSApplicationMain
#6 0x00002c3b in main at main.m:13
Then at next step, EXC_BAD_ACCESS comes. Cocoa is a black box to me
so that I can't figure out what object or value is invalid.
#0 0x90a619f8 in __objc_error
#1 0x90a60060 in _freedHandler
#2 0x927d88cf in NSPopAutoreleasePool
#3 0x93281e28 in -[NSApplication run]
#4 0x93275d2f in NSApplicationMain
#5 0x00002be0 in main at main.m:13
And I place NSLog in windowControllerDidLoadNib like below.
- (void)windowControllerDidLoadNib:(NSWindowController *)
windowController
{
[super windowControllerDidLoadNib:windowController];
NSManagedObjectContext * context = [self managedObjectContext];
NSSet* set = [context registeredObjects];
NSLog ([set description]);
}
The result of the NSLog above is the following:
2007-10-01 10:36:48.036 DepartmentEmployee[390] <NSCFSet: 0xd4790b0>
(< DepartmentMO: 0xd477b20> (entity: Department; id: 0xd477bc0 <x-
coredata:///Department/t8EF2ED34-4D99-441A-9F9E-107AEB9DB962> ; data: {
employees = (
0xd4784a0 <x-coredata:///Employ/t5811C18C-F57F-4FB2-A0C4-
AC34E119A99B>,
0xd4781c0 <x-coredata:///Employ/
t98E09B59-0894-480D-9BA0-55C8F58BB9E0>,
0xd478770 <x-coredata:///Employ/tA69BDE99-E0D4-4507-A8D7-
F1A1665F6D5E>,
0xd478b20 <x-coredata:///Employ/tBD106862-9275-4AB5-
B603-6DAE06F4F93C>,
0xd477ef0 <x-coredata:///Employ/t3F17FB95-04A2-4344-
A09A-7CEE58E31F1C>
);
dept_name = TEST;
}), <DepartmentMO: 0xd46c3a0> (entity: Department; id: 0xd46c450 <x-
coredata:///Department/t47403729-85C5-42D0-8420-114648FEF148> ; data: {
employees = (0xd474960 <x-coredata:///Employ/tEE0CA37A-1D8C-4F76-
A1F8-51AC38DE8A6E>);
dept_name = "51-2\U3000\U30db\U30f3\U30c0\U30a8\U30ec
\U30e1\U30f3\U30c8";
}), <EmployMO: 0xd474930> (entity: Employ; id: 0xd474960 <x-
coredata:///Employ/tEE0CA37A-1D8C-4F76-A1F8-51AC38DE8A6E> ; data: {
department = 0xd46c450 <x-coredata:///Department/
t47403729-85C5-42D0-8420-114648FEF148>;
name = nil;
}), <EmployMO: 0xd478b70> (entity: Employ; id: 0xd478b20 <x-
coredata:///Employ/tBD106862-9275-4AB5-B603-6DAE06F4F93C> ; data: {
department = 0xd477bc0 <x-coredata:///Department/
t8EF2ED34-4D99-441A-9F9E-107AEB9DB962>;
name = nil;
}), <EmployMO: 0xd476ed0> (entity: Employ; id: 0xd476eb0 <x-
coredata:///Employ/t2DE0457E-4138-4D02-AE71-BC40F31CD2D0> ; data: {
department = 0xd476b80 <x-coredata:///Department/
tFCBB6254-2E5D-477E-B9B8-4B12D33C37B4>;
name = nil;
}), <DepartmentMO: 0xd475cb0> (entity: Department; id: 0xd475ce0 <x-
coredata:///Department/tFBBE3019-1B85-4DEE-817C-4BDFCDACFA7C> ; data: {
employees = (0xd476140 <x-coredata:///Employ/tFC4396BF-F05F-4376-
AD19-040726DFFCE6>);
deductKind = 2;
dept_name = "61-2\U3000\U97f3\U97ff\U6a5f\U5668\Uff08
\U4e2d\U53e4\Uff09";
}), <EmployMO: 0xd477440> (entity: Employ; id: 0xd477400 <x-
coredata:///Employ/tE7FC0BFB-DE93-4B60-B501-F8435C2E95C8> ; data: {
department = 0xd476b80 <x-coredata:///Department/
tFCBB6254-2E5D-477E-B9B8-4B12D33C37B4>;
name = nil;
}), <EmployMO: 0xd478330> (entity: Employ; id: 0xd4781c0 <x-
coredata:///Employ/t98E09B59-0894-480D-9BA0-55C8F58BB9E0> ; data: {
department = 0xd477bc0 <x-coredata:///Department/
t8EF2ED34-4D99-441A-9F9E-107AEB9DB962>;
name = nil;
}), <DepartmentMO: 0x332590> (entity: Department; id: 0x3f74c0 <x-
coredata:///Department/t65DD1C8B-658B-4E5C-A430-CD2C39F5AD94> ; data: {
employees = (0xd475640 <x-coredata:///Employ/
t7CDB6496-0E29-4ACB-97B0-BE76A7C8510B>);
dept_name = "61-1\U3000\U30d1\U30bd\U30b3\U30f3";
}), <EmployMO: 0xd476900> (entity: Employ; id: 0xd4768e0 <x-
coredata:///Employ/t9FA3775A-645C-4619-91E8-C885E04D7E32> ; data: {
department = 0xd4765a0 <x-coredata:///Department/
tF81EC534-9B7C-4566-BAA1-A37ABB657FDA>;
name = nil;
}), <EmployMO: 0xd477810> (entity: Employ; id: 0xd4777c0 <x-
coredata:///Employ/tA08507B0-09F9-4B34-8E6C-EE72B38BA4F1> ; data: {
department = 0xd476b80 <x-coredata:///Department/
tFCBB6254-2E5D-477E-B9B8-4B12D33C37B4>;
name = nil;
}), <EmployMO: 0xd476160> (entity: Employ; id: 0xd476140 <x-
coredata:///Employ/tFC4396BF-F05F-4376-AD19-040726DFFCE6> ; data: {
department = 0xd475ce0 <x-coredata:///Department/
tFBBE3019-1B85-4DEE-817C-4BDFCDACFA7C>;
name = nil;
}), <EmployMO: 0xd478740> (entity: Employ; id: 0xd478770 <x-
coredata:///DeductHistory/tA69BDE99-E0D4-4507-A8D7-F1A1665F6D5E> ;
data: {
department = 0xd477bc0 <x-coredata:///Department/
t8EF2ED34-4D99-441A-9F9E-107AEB9DB962>;
name = nil;
}), <DEmployMO: 0xd46e810> (entity: Employ; id: 0xd477310 <x-
coredata:///DeductHistory/t19DEADD5-1BC1-4D3B-B42F-B5550628E307> ;
data: {
department = 0xd476b80 <x-coredata:///Department/
tFCBB6254-2E5D-477E-B9B8-4B12D33C37B4>;
name = nil;
}), <EmployMO: 0xd4770d0> (entity: Employ; id: 0xd477100 <x-
coredata:///DeductHistory/tDE7F27BC-054E-40E6-8613-3A4520A6B19F> ;
data: {
department = 0xd476b80 <x-coredata:///Department/
tFCBB6254-2E5D-477E-B9B8-4B12D33C37B4>;
name = nil;
}), <EmployMO: 0x3f16c0> (entity: Employ; id: 0xd475640 <x-
coredata:///Employ/t7CDB6496-0E29-4ACB-97B0-BE76A7C8510B> ; data: {
department = 0x3f74c0 <x-coredata:///Department/
t65DD1C8B-658B-4E5C-A430-CD2C39F5AD94>;
name = nil;
}), <DepartmentMO: 0xd476530> (entity: Department; id: 0xd4765a0 <x-
coredata:///Department/tF81EC534-9B7C-4566-BAA1-A37ABB657FDA> ; data: {
employees = (0xd4768e0 <x-coredata:///Employ/
t9FA3775A-645C-4619-91E8-C885E04D7E32>);
dept_name = "61-3\U3000\U30d7\U30e9\U30ba\U30de\U30c7
\U30a3\U30b9\U30d7\U30ec\U30fc";
}), <DepartmentMO: 0xd476b30> (entity: Department; id: 0xd476b80 <x-
coredata:///Department/tFCBB6254-2E5D-477E-B9B8-4B12D33C37B4> ; data: {
employees = (
0xd476eb0 <x-coredata:///Employ/t2DE0457E-4138-4D02-AE71-
BC40F31CD2D0>,
0xd477400 <x-coredata:///Employ/tE7FC0BFB-DE93-4B60-B501-
F8435C2E95C8>,
0xd4777c0 <x-coredata:///Employ/tA08507B0-09F9-4B34-8E6C-
EE72B38BA4F1>,
0xd477100 <x-coredata:///Employ/
tDE7F27BC-054E-40E6-8613-3A4520A6B19F>,
0xd477310 <x-coredata:///Employ/t19DEADD5-1BC1-4D3B-B42F-
B5550628E307>
);
dept_name = "\U30c6\U30b9\U30c8";
}), < EmployMO: 0xd477f10> (entity: Employ; id: 0xd477ef0 <x-
coredata:///Employ/t3F17FB95-04A2-4344-A09A-7CEE58E31F1C> ; data: {
department = 0xd477bc0 <x-coredata:///Department/
t8EF2ED34-4D99-441A-9F9E-107AEB9DB962>;
name = nil;
}), <EmployMO: 0xd478470> (entity: Employ; id: 0xd4784a0 <x-
coredata:///Employ/t5811C18C-F57F-4FB2-A0C4-AC34E119A99B> ; data: {
department = 0xd477bc0 <x-coredata:///Department/
t8EF2ED34-4D99-441A-9F9E-107AEB9DB962>;
name = nil;
}))
Uli, thanks for your advice. I'll go see the URL and study more.
Norio
On 2007/10/01, at 1:52, Fritz Anderson wrote:
On 30 Sep 2007, at 9:26 AM, Norio Ota wrote:
An EXC_BAD_ACCESS error comes only after my app reads my custom
format type of data and reads document nib file.
1. When new document is selected, no problem.
2. When open document is selected and the app reads one of three
formats which Core Data supports, no problem.
3. Only after reading custom formatted file and after
windowControllerDidLoadNib gets called, EXC_BAD_ACCESS comes.
The windowControllerDidLoadNib method calls [super
windowControllerDidLoadNib] and detects how each attribute of
managedObjects
has been set.
It looks fine that the custom formatted data is read, and the
objects created and initialized with the data seem to be fine.
Because the value of each attribute of managedObjects was what I
expected.
You don't say what you learned from the debugger. Does any of your
code appear in the stack trace?
― F
_______________________________________________
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