开发者

Clicking on NSMenu item causes a crash [closed]

开发者 https://www.devze.com 2023-04-12 17:44 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I have problem I cannot find the cause. I have menu and application crashes as soon as app name menu item, or File or Edit is selected. Other 4 menu options work fine.

I cannot track the error, since the crash occurs as soon as you select menu drop down, you actually don't even come so far to select a 开发者_Python百科menu option.

This is declaration code:

    IBOutlet NSMenu *miFile;
IBOutlet NSMenuItem *miNewProduct;
IBOutlet NSMenuItem *miDeleteProduct;
IBOutlet NSMenuItem *miDataupdateUndo;
IBOutlet NSMenuItem *miExit;

IBOutlet NSMenu *miEdit;

IBOutlet NSMenu *miExtra;
IBOutlet NSMenuItem *miSettings;
IBOutlet NSMenuItem *miFilestoreCleanup;
IBOutlet NSMenuItem *miEAN;
IBOutlet NSMenuItem *miBeatport;

IBOutlet NSMenu *miInvoice;
IBOutlet NSMenuItem *miInvoicePreview;
IBOutlet NSMenuItem *miInvoiceEnd;
IBOutlet NSMenuItem *miInvoiceExport;
IBOutlet NSMenuItem *miAccounting;

IBOutlet NSMenu *miStockList;
IBOutlet NSMenuItem *miServerRecieve;
IBOutlet NSMenuItem *miExport;
IBOutlet NSMenuItem *miImportModule;

IBOutlet NSMenu *miHelp;
IBOutlet NSMenuItem *miSendProtocol;
IBOutlet NSMenuItem *miHelpLink;
IBOutlet NSMenuItem *miReleaseNotes;
IBOutlet NSMenuItem *miCheckUpdate;
IBOutlet NSMenuItem *miRebeatDotCom;
IBOutlet NSMenuItem *miAbout;

Does anybody have an idea, what could cause a crash? It is EXC_BAD_ACCESS crash, I have used all Intsruments tools and found nothing...

Here is assembly code at point of crash if useful:

0x00007fff8461d39c  <+0000>  push   %rbp
0x00007fff8461d39d  <+0001>  mov    %rsp,%rbp
0x00007fff8461d3a0  <+0004>  push   %r14
0x00007fff8461d3a2  <+0006>  push   %rbx
0x00007fff8461d3a3  <+0007>  mov    (%rdi),%rbx   ///CRASH
0x00007fff8461d3a6  <+0010>  cmp    %rsi,%rbx
0x00007fff8461d3a9  <+0013>  je     0x7fff8461d3c6     <_ZN11TCFRetainedIPK8__CTFontE6RetainES2_+42>
0x00007fff8461d3ab  <+0015>  mov    %rdi,%r14
0x00007fff8461d3ae  <+0018>  test   %rsi,%rsi
0x00007fff8461d3b1  <+0021>  je     0x7fff8461d3be <_ZN11TCFRetainedIPK8__CTFontE6RetainES2_+34>
0x00007fff8461d3b3  <+0023>  mov    %rsi,%rdi
0x00007fff8461d3b6  <+0026>  callq  0x7fff8469c642 <dyld_stub_CFRetain>
0x00007fff8461d3bb  <+0031>  mov    %rax,%rsi
0x00007fff8461d3be  <+0034>  mov    %rsi,(%r14)
0x00007fff8461d3c1  <+0037>  test   %rbx,%rbx
0x00007fff8461d3c4  <+0040>  jne    0x7fff8461d3cb <_ZN11TCFRetainedIPK8__CTFontE6RetainES2_+47>
0x00007fff8461d3c6  <+0042>  pop    %rbx
0x00007fff8461d3c7  <+0043>  pop    %r14
0x00007fff8461d3c9  <+0045>  pop    %rbp
0x00007fff8461d3ca  <+0046>  retq   
0x00007fff8461d3cb  <+0047>  mov    %rbx,%rdi
0x00007fff8461d3ce  <+0050>  pop    %rbx
0x00007fff8461d3cf  <+0051>  pop    %r14
0x00007fff8461d3d1  <+0053>  pop    %rbp
0x00007fff8461d3d2  <+0054>  jmpq   0x7fff8469c63c <dyld_stub_CFRelease>
0x00007fff8461d3d7  <+0059>  nop    

Menu was created completely in IB. it is ran on 10.7.2. Crashes on 10.6 as well. Uses GC. No Zombies, Allocations, leaks or any other things that can be caught with Instruments of whatsoever - I need to repeat this obviously...


I can not comment about your code by only seeing interface file. you should refer MenuItemView code. "MenuItemView" is a Cocoa application that demonstrates embedding NSViews inside NSMenuItems. This sample is intended to show how this is done with various user interface elements such as controls as well as the application's menu bar. you can also refer First Steps in GNUstep GUI Programming: NSApplication, NSMenu.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号