Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
I have a couple of additional windows that open for my app. I have buttons that close them just fine. The other day I used the red button on the top left to close the window and it crashed my program.

I am guessing I need to code an order out for that button? I don't even know where it is located if I do need to write code for it?

Thanks,

-Lars
 
1. What does the crash log show was executing at the time of the crash?


2. Run your program under Instruments.app, with zombies enabled (google it). Do the action that causes the crash (click the red button). If you see a notice that you're using a deallocated object (i.e. a zombie), then find and fix your memory management bug.

I have mentioned Instruments and zombies before. It's a pretty normal part of debugging. If you're not doing it, and you have no strategy for debugging unexpected crashes, you should probably spend a little time writing down some specific steps to take when things crash. When you can't remember the systematic steps to take, refer to the written procedure. One of those steps should be "Post the crash log when asking on MacRumors".
 
Thanks Chown33, I will be home tonight and look at it. I too the program on a jump drive to our party that we had and showed it and saw the crash on his computer.

I will crash the program and get the information on the report. But as far as I have seen those buttons manage themselves unless I want to override them.
 
You may have to get the crash log from the other computer. It's possible the problem only appears when running in that computer's environment. You may not be able to duplicate the problem. This would not be unusual. You should still try to duplicate the problem, just warning that it may not succeed.
 
Here is the crash log from the other computer.I tested it a little more and I can have 3 NSWindows open and they all crash the program. But I don't think it is the window close button anymore. They close fine but when I click on the NSButton to bring them up a second time, that is when they crash. The problem must be in my code.

Here is the log
Process: Xp Calc2 [202]
Path: /Users/lars/Desktop/Xp Calc_v9.1.app/Contents/MacOS/Xp Calc2
Identifier: larsTest.Xp-Calc2
Version: 1.0 (2.10)
Code Type: X86 (Native)
Parent Process: launchd [162]

Date/Time: 2011-08-06 10:26:16.203 -0700
OS Version: Mac OS X 10.6.7 (10J869)
Report Version: 6
Sleep/Wake UUID: A6A62FB2-7997-4B95-BCFF-C8F155EDA11B

Interval Since Last Report: 481183 sec
Crashes Since Last Report: 34
Per-App Interval Since Last Report: 136588 sec
Per-App Crashes Since Last Report: 23
Anonymous UUID: D7C0EDFD-57DA-45F3-8A2B-487D0AFEC29F

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000000000003f
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Application Specific Information:
objc_msgSend() selector name: makeKeyAndOrderFront:


Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x97468ed7 objc_msgSend + 23
1 com.apple.AppKit 0x90914c46 -[NSApplication sendAction:to:from:] + 112
2 com.apple.AppKit 0x909f4465 -[NSControl sendAction:to:] + 108
3 com.apple.AppKit 0x909eff12 -[NSCell _sendActionFrom:] + 169
4 com.apple.AppKit 0x909ef209 -[NSCell trackMouse:inRect:eek:fView:untilMouseUp:] + 1808
5 com.apple.AppKit 0x90a448a1 -[NSButtonCell trackMouse:inRect:eek:fView:untilMouseUp:] + 524
6 com.apple.AppKit 0x909edc5f -[NSControl mouseDown:] + 812
7 com.apple.AppKit 0x909ebc68 -[NSWindow sendEvent:] + 5549
8 com.apple.AppKit 0x90904817 -[NSApplication sendEvent:] + 6431
9 com.apple.AppKit 0x908982a7 -[NSApplication run] + 917
10 com.apple.AppKit 0x908902d9 NSApplicationMain + 574
11 larsTest.Xp-Calc2 0x00002361 0x1000 + 4961

Thread 1: Dispatch queue: com.apple.libdispatch-manager
0 libSystem.B.dylib 0x94c28922 kevent + 10
1 libSystem.B.dylib 0x94c2903c _dispatch_mgr_invoke + 215
2 libSystem.B.dylib 0x94c284f9 _dispatch_queue_invoke + 163
3 libSystem.B.dylib 0x94c2829e _dispatch_worker_thread2 + 240
4 libSystem.B.dylib 0x94c27d21 _pthread_wqthread + 390
5 libSystem.B.dylib 0x94c27b66 start_wqthread + 30

Thread 2:
0 libSystem.B.dylib 0x94c279b2 __workq_kernreturn + 10
1 libSystem.B.dylib 0x94c27f48 _pthread_wqthread + 941
2 libSystem.B.dylib 0x94c27b66 start_wqthread + 30

Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x00301620 ebx: 0x90914bea ecx: 0x91073320 edx: 0x0000001f
edi: 0x0012c0d0 esi: 0x00300800 ebp: 0xbffff438 esp: 0xbffff418
ss: 0x0000001f efl: 0x00010202 eip: 0x97468ed7 cs: 0x00000017
ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037
cr2: 0x0000003f

Binary Images:
0x1000 - 0x7ffb +larsTest.Xp-Calc2 1.0 (2.10) <ED774D88-2E56-3566-B776-5C64955FAFEC> /Users/lars/Desktop/Xp Calc_v9.1.app/Contents/MacOS/Xp Calc2
0x400000 - 0x499fe7 com.apple.speec

I need to learn how to read these logs.
 
I need to learn how to read these logs.

Well, it crashed in Thread 0. Some code handles a mousedown event, then an action is sent, at last the NSApplication method sendAction:to:from: is called, that tries to send a message, and the attempt to send the message crashes.

Most likely sending a message to an object that doesn't exist anymore. I bet closing the window released it, and then you try to make a released window visible again. Have look in Interface Builder at the properties of the windows that you are closing if there is anything related to releasing a window when it is closed.
 
Most likely sending a message to an object that doesn't exist anymore. I bet closing the window released it, and then you try to make a released window visible again. Have look in Interface Builder at the properties of the windows that you are closing if there is anything related to releasing a window when it is closed.

Or run under Instruments with zombies enabled, and it will tell about every attempt to message an object that no longer exists.
 
Thanks guys, I had time to look at it today. I did the quick solve in IB and unchecked the 3 boxes so the user can't select them. When the additional NSWindow opens up and they press the NSButton to 'orderout' that window it works fine.

I did try a test thought and created an tried to have the first line of code in the NSButton and orderOut:self before I used themakeKeyAndOrderFront: to try to close just in case. It did not work.

With regards to the crash report. I am guessing this is the important part
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Application Specific Information:
objc_msgSend() selector name: makeKeyAndOrderFront:


Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x97468ed7 objc_msgSend + 23
1 com.apple.AppKit 0x90914c46 -[NSApplication sendAction:to:from:] + 112
2 com.apple.AppKit 0x909f4465 -[NSControl sendAction:to:] + 108
3 com.apple.AppKit 0x909eff12 -[NSCell _sendActionFrom:] + 169
4 com.apple.AppKit 0x909ef209 -[NSCell trackMouse:inRectfView:untilMouseUp:] + 1808
5 com.apple.AppKit 0x90a448a1 -[NSButtonCell trackMouse:inRectfView:untilMouseUp:] + 524
6 com.apple.AppKit 0x909edc5f -[NSControl mouseDown:] + 812
7 com.apple.AppKit 0x909ebc68 -[NSWindow sendEvent:] + 5549
8 com.apple.AppKit 0x90904817 -[NSApplication sendEvent:] + 6431
9 com.apple.AppKit 0x908982a7 -[NSApplication run] + 917
10 com.apple.AppKit 0x908902d9 NSApplicationMain + 574
11 larsTest.Xp-Calc2 0x00002361 0x1000 + 4961

Thread 1: Dispatch queue: com.apple.libdispatch-manager

Is this part where it errored
Application Specific Information:
objc_msgSend() selector name: makeKeyAndOrderFront:

I can follow the list and see what is happening but what do the +numbers mean?
 
Is this part where it errored

No, it crashed in "objc_msgSend" which was called from "-[NSApplication sendAction:to:from:]". You can Google for "objc_msgSend", but it is the code that sends instance messages.
 
I see, thanks.

I think I know what happened. I have 3 windows in my xib file that are just hidden and I use the makeKeyAndOrderFront: When an NSButton is pressed. If I close that second window using the red button it really closes it instead of hiding it which I do with another NSButton to Orderout.

So when I click on the NSButton to makeKeyAndOrderFront: again, there is nothing to bring up.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.