• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Freezes and crashes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Freezes and crashes


  • Subject: Re: Freezes and crashes
  • From: Matt Judy <email@hidden>
  • Date: Mon, 22 Jul 2002 16:18:28 -0700

I would say that your instinct to rebuild things may be a good step. Make a copy before you do... if it is the nib file, then Apple should definitely get their hands on it; file a bug in the Apple Bugreporter.

But there are lots of crashes to be had when dealing with NSTask et. al., and when using a wrapper (assuming Moriarity's) they can be even more difficult to trace. Also, it looks as if you're trying to set an environment variable using tcsh. Since NSTask allows for environment variables already, it may be cleaner to modify TaskWrapper's -initWithController:arguments: method to allow the passing of an environment dictionary.

From some code I helped a friend to write. Add ivars and modify your prototype:

@interface TaskWrapper : NSObject {
...
NSArray *arguments;
NSString *dir;
NSDictionary *environment;
...
}

- (id)initWithController:(id <TaskWrapperController>)cont withDir:(NSString*)path withEnvironment:(NSDictionary *)env arguments:(NSArray *)args;

...
@end

Then modify the implementation of that method to test and set the arguments to the ivars. Also, be sure to modify the -dealloc method to release them, and change the -startProcess method to also use setCurrentDirectoryPath and setEnvironment on the NSTask with your new ivars.

Hope That Helps,
--
Matt Judy
Programmer: Cocoa UE
NibFile.com

On Sunday, July 21, 2002, at 09:43 PM, Andrew Merenbach wrote:

The problem at first glance appears to be--get ready for this--that the width of the default button has something to do with the freeze. When the button is wide enough to accomodate the word "Calculate," pressing return repeatedly seems to freeze up my copy of IB, and my program--but when it's just wide enough to encompass the letter "a," it works perfectly in IB. However... it still doesn't work properly in my program itself. Now when I press return to activate the default button, the program quits with a signal 10 error, and if I click the button instead, the program quits with a signal 11 error.

I used NSLog() to narrow down the apparent freeze to one line of code:

searchTask=[[TaskWrapper alloc] initWithController:self arguments:[NSArray arrayWithObjects:@"/bin/tcsh",@"-c",[[NSString alloc] initWithFormat: @"echo 'scale=%@;%@'|bc",scaleString,equation],nil]];

I would ask, "can you find something wrong?" if I weren't so positive this line is completely perfect. I use the *exact* same line in all of the sixteen or so windows in my program. The NSMutableString "equation" is defined properly, too.

And now that the button is its full size again (I'm testing it right now), it now only crashes when I press return instead of clicking the button.

Sorry that this is such a long message. The program is consistently inconsistent (say that five times fast). I have a strong suspicion that something is incredibly wrong with my nib file. I can't see another explanation; my variable names don't appear to have any conflicts, debugging has produced nothing, and the window is very similar to another window, which works perfectly. In fact, the code for the window controller is identical to the other code in every way, shape, and form, except for the names of variables, which have been changed very slightly.

Does anyone have any ideas on what to do? Is it possible that the tab view used in my nib file is corrupted (as the nib is new; I simply copied and pasted my tab view in from an old file).

Thanks in advance,
Andrew Merenbach

On Sunday, July 21, 2002, at 05:39 PM, Mark de Jong wrote:

Andrew,

The way I do it is to create a new target. I usually call it "<projectName>-Debug" :-)

Make sure "Generating Debug Symbols" is selected, "Optimization Level: None" and the following "Build Settings" are set:

COPY_PHASE_STRIP = NO
DEBUGGING_SYMBOLS = YES

In the "Breakpoints" tab click on "New" and enter "-[NSException raise]" This will cause the debugger to break whenever an uncaught exception has been raised. To me, this stuff is *very* revealing of what's going on in my code.

Hope this helps,

-- Mark


On Sunday, July 21, 2002, at 05:03 PM, Andrew Merenbach wrote:

There's nothing at all in the Console, except some messages from before. I would like to get this thing run in GDB, but how do I go about it? I've gotten about as far as running the executable from within Project Builder with the debugger turned on, but how do I get the NSExceptionRaise thing to work, and where do I put it?

Thank you,
Andrew Merenbach

On Sunday, July 21, 2002, at 04:34 PM, Mark de Jong wrote:

Andrew,

Hmmm... this sounds bizarre. You don't see anything at all in the console? Or do you mean you don't see anything that seems to relate to the problem?

If you haven't done so, I'd run this in gdb with a breakpoint set to catch uncaught exceptions.

(gdb) break -[NSException raise])

I have found all kinds of weird bugs in my code this way. :-)

HTH,

-- Mark

On Sunday, July 21, 2002, at 04:21 PM, Andrew Merenbach wrote:

I'm working on a big program at the moment, and I'm encountering the same sort of error I encountered while using AppleScript Studio to do my work: when I enter a value of 200 into a certain text field and click a button, my program hangs and I need to force quit. This was the main reason I switched to Cocoa in the first place, and though I'm very glad I did, this is disconcerting. Nothing appear in the Console (both in Project Builder and in /Applications/Utilities/), and this only seems to happen when I enter a large number. (The oddest thing is that the windows that hang my program now are the exact same ones that caused the crash under AppleScript Studio.)

My program functions differently from the AS-S one, too, in that it sends calculations to the BC calculator program, so I haven't told my program to do any arithmetic on its own.

Any suggestions? Is this a known problem? Will it be fixed in Jaguar?

Thanks in advance,
Andrew Merenbach
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.

References: 
 >Freezes and crashes (From: Andrew Merenbach <email@hidden>)

  • Prev by Date: Re: How to control relative paths in Unix task?
  • Next by Date: Re: Trying to print nsimage... What am I doing wrong?
  • Previous by thread: Re: Freezes and crashes
  • Next by thread: how do I set a panel's title?
  • Index(es):
    • Date
    • Thread