FROM : Scott Stevenson
DATE : Tue Nov 23 19:57:03 2004
On Nov 23, 2004, at 9:35 AM, Jason Bell wrote:
> AIPerson *person;
> person = [[AIPerson alloc] init];
>
> Pretty simple, right? We all do it millions of times. Well, the
> second line produces a crash log with this:
>
> Exception: EXC_BAD_ACCESS (0x0001)
> Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000010
>
> Thread 0 Crashed:
> 0 libobjc.A.dylib 0x9083293c class_initialize + 0x9c
> 1 libobjc.A.dylib 0x9083294c class_initialize + 0xac
> 2 libobjc.A.dylib 0x90831524
> _class_lookupMethodAndLoadCache + 0x84
> 3 libobjc.A.dylib 0x90831298 objc_msgSend + 0xb8
> ......
>
> It doesn't even get to the init method. I don't have my own
> +(void)initialize method and if I add one, it doesn't get run either.
> I've tried a clean-rebuild and even deleting the entire build folder.
> Since I get no compile-time errors or warnings and this log is all I
> have to go on, I'm at a bit of a loss.
This is a somewhat unorthodox approach, but you could try something
like:
id person = (id)malloc ( sizeof(id) );
id alias = person;
NSLog(@"crashed yet? part 1");
alias->isa = AIPerson;
NSLog(@"crashed yet? part 2");
[alias init];
Or something like that. From what I remember, the "alias" somehow
circumvents the protected status of the isa member. I'm also not 100%
sure the third line is correct.
If I'm missing something obvious, I'll blame it on the fact that the
coffee hasn't fully entered my system yet.
- Scott
--
http://treehouseideas.com/
http://theobroma.treehouseideas.com/ [blog]
DATE : Tue Nov 23 19:57:03 2004
On Nov 23, 2004, at 9:35 AM, Jason Bell wrote:
> AIPerson *person;
> person = [[AIPerson alloc] init];
>
> Pretty simple, right? We all do it millions of times. Well, the
> second line produces a crash log with this:
>
> Exception: EXC_BAD_ACCESS (0x0001)
> Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000010
>
> Thread 0 Crashed:
> 0 libobjc.A.dylib 0x9083293c class_initialize + 0x9c
> 1 libobjc.A.dylib 0x9083294c class_initialize + 0xac
> 2 libobjc.A.dylib 0x90831524
> _class_lookupMethodAndLoadCache + 0x84
> 3 libobjc.A.dylib 0x90831298 objc_msgSend + 0xb8
> ......
>
> It doesn't even get to the init method. I don't have my own
> +(void)initialize method and if I add one, it doesn't get run either.
> I've tried a clean-rebuild and even deleting the entire build folder.
> Since I get no compile-time errors or warnings and this log is all I
> have to go on, I'm at a bit of a loss.
This is a somewhat unorthodox approach, but you could try something
like:
id person = (id)malloc ( sizeof(id) );
id alias = person;
NSLog(@"crashed yet? part 1");
alias->isa = AIPerson;
NSLog(@"crashed yet? part 2");
[alias init];
Or something like that. From what I remember, the "alias" somehow
circumvents the protected status of the isa member. I'm also not 100%
sure the third line is correct.
If I'm missing something obvious, I'll blame it on the fact that the
coffee hasn't fully entered my system yet.
- Scott
--
http://treehouseideas.com/
http://theobroma.treehouseideas.com/ [blog]
| Related mails | Author | Date |
|---|---|---|
| Jason Bell | Nov 23, 18:35 | |
| Scott Stevenson | Nov 23, 19:57 | |
| Jason Bell | Nov 23, 20:20 | |
| Guy English | Nov 23, 20:27 |






Cocoa mail archive

