[Mono-osx] Monomac NSTableview Contextmenue

Thomas Leppkes tleppkes at jjk.de
Tue Apr 5 02:10:41 EDT 2011


Hi,

i have a big problem with NSMenu in MonoMac. When i try to dynamical creata a ContextMenue for an Item in a NSTableView i got every 3-4 times a SIGSEGV error and i cant find a solution on the web nor have an idea what this cause...

can you help me?
greets
tom


partial void listClicked (NSTableView sender)
                               {



                                               if (TableViewer.Menu == null) {
                                                               TableViewer.Menu = new NSMenu ();
                                               }

                                               if (TableViewer.SelectedRow > -1) {


                                                               TableViewer.Menu.RemoveAllItems ();

                                                               foreach (var menuentry in myListMenu.Items) {
                                                                              NSMenuItem mi;
                                                                              if (!string.IsNullOrEmpty (menuentry.Text)) {

                                                                                              mi = new NSMenuItem (menuentry.Text,menuClicked);

                                                                                              TableViewer.Menu.AddItem (mi);
                                                                              } else {
                                                                                              TableViewer.Menu.AddItem (NSMenuItem.SeparatorItem);
                                                                              }

                                                               }
                                               }

                               }


void menuClicked (object Sender, EventArgs e)
                               {


                                               NSMenuItem M = (NSMenuItem)Sender;

                                               string SenderText = M.Title.ToString ();

                                               foreach (ProduktionsMenuItem MItem in ProduktionsMenu.Items) {
                                                               if (MItem.Text == SenderText) {
                                                                              ProduktionsMenu.WorkerFunction (MItem.MItemTag);
                                                               }
                                               }



                               }




Stacktrace:

  at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0x00003>
  at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0x00003>
  at MonoMac.AppKit.NSApplication.Main (string[]) [0x00000] in /cvs/monomac/src/AppKit/NSApplication.cs:74
  at JJKproduktionViewMac.MainClass.Main (string[]) [0x00005] in /Developer/JJKproduktion3/JJKproduktionViewMac/Main.cs:14
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00049, 0x0012b>

Native stacktrace:

                0   JJKproduktionViewMac                0x000c96ef mono_handle_native_sigsegv + 343
                1   JJKproduktionViewMac                0x00010519 mono_sigsegv_signal_handler + 306
                2   libSystem.B.dylib                   0x964699bb _sigtramp + 43
                3   ???                                 0xffffffff 0x0 + 4294967295
                4   AppKit                              0x930ee3a0 -[NSCarbonMenuImpl _carbonUpdateStatusEvent:handlerCallRef:] + 527
                5   AppKit                              0x930ebf79 NSSLMMenuEventHandler + 404
                6   HIToolbox                           0x92109e29 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1567
                7   HIToolbox                           0x921090f0 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 411
                8   HIToolbox                           0x9212b981 SendEventToEventTarget + 52
                9   HIToolbox                           0x92157e3b _ZL18SendHICommandEventmPK9HICommandmmhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef + 448
                10  HIToolbox                           0x92157c78 UpdateHICommandStatusWithCachedEvent + 66
                11  HIToolbox                           0x92105619 _ZN13HIApplication12EventHandlerEP25OpaqueEventHandlerCallRefP14OpaqueEventRefPv + 1287
                12  HIToolbox                           0x92109e29 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1567
                13  HIToolbox                           0x921090f0 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 411
                14  HIToolbox                           0x9212b981 SendEventToEventTarget + 52
                15  HIToolbox                           0x92155735 _ZL15SendMenuOpeningP14MenuSelectDataP8MenuDatadmP14__CFDictionaryhPh + 826
                16  HIToolbox                           0x922fd857 _ZL19PopUpMenuSelectCoreP8MenuData5PointdS1_tjPK4RecttmS4_S4_PK10__CFStringPP13OpaqueMenuRefPt + 962
                17  HIToolbox                           0x922fded0 _HandlePopUpMenuSelection7 + 678
                18  AppKit                              0x9338161e _NSSLMPopUpCarbonMenu3 + 3937
                19  AppKit                              0x933819ae -[NSCarbonMenuImpl _popUpContextMenu:withEvent:forView:withFont:] + 220
                20  AppKit                              0x934f980f -[NSMenu _popUpContextMenu:withEvent:forView:withFont:] + 270
                21  AppKit                              0x934f98ae -[NSMenu _popUpContextMenu:withEvent:forView:] + 63
                22  AppKit                              0x934f9681 -[NSMenu _popUpMenuWithEvent:forView:] + 52
                23  AppKit                              0x936f00d1 -[NSView rightMouseDown:] + 103
                24  AppKit                              0x933e1e1b -[NSControl _rightMouseUpOrDown:] + 534
                25  AppKit                              0x931cefe0 -[NSWindow sendEvent:] + 5757
                26  AppKit                              0x930e7b2f -[NSApplication sendEvent:] + 6431
                27  AppKit                              0x9307b4ff -[NSApplication run] + 917
                28  AppKit                              0x93073535 NSApplicationMain + 574
                29  ???                                 0x02228fbb 0x0 + 35819451
                30  ???                                 0x02228dbb 0x0 + 35818939
                31  ???                                 0x004d3fed 0x0 + 5062637
                32  ???                                 0x004d414c 0x0 + 5062988
                33  JJKproduktionViewMac                0x000102e4 mono_jit_runtime_invoke + 1339
                34  JJKproduktionViewMac                0x001df415 mono_runtime_invoke + 138
                35  JJKproduktionViewMac                0x001e15c0 mono_runtime_exec_main + 669
                36  JJKproduktionViewMac                0x001e09aa mono_runtime_run_main + 814
                37  JJKproduktionViewMac                0x0009cd1e mono_jit_exec + 200
                38  JJKproduktionViewMac                0x0009cf58 main_thread_handler + 558
                39  JJKproduktionViewMac                0x0009f28f mono_main + 7577
                40  JJKproduktionViewMac                0x00004009 mono_main_with_options + 539
                41  JJKproduktionViewMac                0x00004090 main + 49
                42  JJKproduktionViewMac                0x00003dc2 start + 54

Debug info from gdb:

/tmp/mono-gdb-commands.bWt1jY:1: Error in sourced command file:
unable to debug self

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20110405/aff042aa/attachment-0001.html 


More information about the Mono-osx mailing list