Re: Debugger exits with signal 5 (SIGTRAP) after computer crashed.
Re: Debugger exits with signal 5 (SIGTRAP) after computer crashed.
- Subject: Re: Debugger exits with signal 5 (SIGTRAP) after computer crashed.
- From: Ron Fleckner <email@hidden>
- Date: Mon, 10 Dec 2007 07:38:29 +1100
Hi Johannes,
On 10/12/2007, at 12:30 AM, Johannes Huning wrote:
Your suggestion fixed my problem : )
Good to know.
I started playing around with breakpoints and several NSLog
messages to locate the problem. Even the mistake is found, I'm a
little confused:
To implement a highlight effect, I created a instance variable as a
trigger ..
BOOL _highlighted;
To implement drag and drop, I added the necessary methods:
- (NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender;
- (BOOL)prepareForDragOperation:(id < NSDraggingInfo >)sender;
- (void)draggingExited:(id < NSDraggingInfo >)sender;
- (BOOL)performDragOperation:(id < NSDraggingInfo >)sender;
- (void)concludeDragOperation:(id < NSDraggingInfo >)sender;
In these methods I either set highlighted to YES or NO and called
[self setNeedsDisplay:YES]; to update my view. Then, In the
drawRect: method I checked for self.highlighted and displayed
either a normal or a coloured background .. depending on
self.highlighted's state.
Now, in the corrupted project (the one with the signal 5, I
described before), self.highlighted was _not_ set to NO (or YES) in
the initialiser (initWithFrame:) - but the app worked just fine. On
the other hand, in this project, I had to set self.highlighted to
NO (or YES in the initialiser) to prevent the app from crashing
while the drag & drop operations.
What's my mistake? Or is there any logical explanation for this
behaviour?
Kinds regards,
Johannes Huning
Sorry, I'm really no expert. I just thought I would suggest an
approach I would take. Your description of highlighting seems fine
to me. Your original problem 'seems' like it was related to memory.
There is ALWAYS a logical explanation. Sometimes it's just very
difficult to find it. I've just been reading Aaron Hillegass on
writing code to aid in debugging and I think I will begin using his
suggestions: break the code down into discreet statements, avoiding
deep nesting. This way you can, either with the debugger or simply
using NSLog() or printf() statements, find out more easily what's
going on. I think if you closely read your 'corrupted' project's
code, you'll be able to track down where things have gone awry.
On Dec 9, 2007, at 5:20 AM, Ron Fleckner wrote:
On 09/12/2007, at 1:41 PM, Johannes Huning wrote:
Dear Cocoa Developers,
I just started programming Objective-C and Cocoa. As a first
Project, I'm creating an application, that generates thumbnails
of files dragged to a custom view. Until now, everything worked
fine. Then while playing around with my app, the computer stopped
responding and I had to turn the Mac of by pressing the power
button for a few seconds.
It's very unlikely that a memory problem in your application will
cause the computer to die. In future, if you get the same effect,
just force quit the application, either via the Apple menu item Force
Quit or using the keys Command-Option-Escape.
Good luck.
Kind regards,
Johannes Huning
Johannes,
until someone more knowledgable chimes in, I think you should set
breakpoints in the method which is first called when you drag in
images, then breakpoints along whatever chain of methods you
have. Build and Debug (Command-Y), then step from breakpoint to
breakpoint. Maybe you'll see what's happening there. Also, use
of NSLog() is very helpful in these situations.
HTH,
Ron
_______________________________________________
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:
40ozemail.com.au
This email sent to email@hidden
_______________________________________________
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