Re: Weird problem with array declaration in action
Re: Weird problem with array declaration in action
- Subject: Re: Weird problem with array declaration in action
- From: Chris Ryland <email@hidden>
- Date: Sat, 8 Feb 2003 23:47:45 -0500
On Saturday, February 8, 2003, at 11:09 PM, David Hinz wrote:
In a new app that I'm writing it is crashing because of what looks like
some type of inconsistency between my source code and the NIB file.
The dump is:
Thread 0 Crashed:
#0 0x00004388 in -[NewAppController start:] (NewAppController.m:16)
#1 0x930f90e4 in -[NSApplication sendAction:to:from:]
#2 0x93119868 in -[NSControl sendAction:to:]
#3 0x9315dfac in -[NSCell _sendActionFrom:]
#4 0x930f2ad4 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:]
#5 0x9315dbcc in -[NSButtonCell
trackMouse:inRect:ofView:untilMouseUp:]
#6 0x9312d504 in -[NSControl mouseDown:]
#7 0x930c0888 in -[NSWindow sendEvent:]
#8 0x930a8788 in -[NSApplication sendEvent:]
#9 0x930b1608 in -[NSApplication run]
#10 0x9315f6b8 in NSApplicationMain
#11 0x00004160 in main (main.m:13)
#12 0x00003ee4 in _start (crt.c:267)
#13 0x00003d64 in start
The strange thing is if I comment out or change a single line of code
in the (IBAction)start:(id)sender method then the application works.
The line is
int pixels[400][400];
It is used to store the state of pixels that will eventually be in an
NSView. (The subclass of the NSView doesn't even exist yet, and the
array isn't used anywhere else in the code at this point either.)
Also if I change the line to be:
int pixels[400][300];
the the code works also. At this point I can comment out everything
else (about 40 lines of code) from the start: method and the program
still dumps. That is why I think the problem is some type of
inconsistency between the NIB and the code. I've tried selecting the
class in IB and re-reading the .h file. That hasn't helped.
Any ideas? :) I've been fighting this problem for several hours and
have run out of ideas.
Forgive me for suggesting something so simple, but isn't this just
because your per-thread stack storage can't hold 400 x 400 x 4 bytes
(640K, roughly) for this stack local?
Cheers!
--Chris Ryland / Em Software, Inc. / www.emsoftware.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.