Re: [Gtk-osx-users] ige-mac-integration



On Sep 8, 2010, at 9:00 AM, Mikkel Kruse Johnsen wrote:

> Hi John Ralls
> 
> I'm using your ige-mac-integration package. But I have crashes on mac when menues changes (UIManager). Here is what I get:
> 
> ----
> 2010-09-08 16:44:51.488 mono[672:613] *** Assertion failure in -[NSMenu insertItem:atIndex:], /SourceCache/AppKit/AppKit-1038.32/Menus.subproj/NSMenu.m:554
> 2010-09-08 16:44:51.491 mono[672:613] An uncaught exception was raised
> 2010-09-08 16:44:51.496 mono[672:613] Invalid parameter not satisfying: (index >= 0) && (index <= [_itemArray count])
> 2010-09-08 16:44:51.498 mono[672:613] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: (index >= 0) && (index <= [_itemArray count])'
> -----
> 
> If I make this change to "src/cocoa_menu_item.c":
> 
> ----
> @@ -496,8 +501,9 @@ cocoa_menu_item_add_item (NSMenu* cocoa_menu, GtkWidget* menu_item, int index)
> 
>    if (index >= 0 && index < [cocoa_menu numberOfItems]) 
>      [ cocoa_menu insertItem:cocoa_item atIndex:index];
> -  else 
> -    [ cocoa_menu addItem:cocoa_item];
> +  else
> +    [cocoa_menu insertItem:cocoa_item atIndex:0];
> +    //[ cocoa_menu addItem:cocoa_item];
> 
>    cocoa_menu_item_sync(menu_item);
> }
> ---
> 
> Then everything works fine, accept that the menu's is reversed. But no crashes.
> 
> Do you have any idea what could be the problem ? 
> 
> (Se attachment for full dump)
> 
> Many thanks, for the otherwise great integration.

First of all, support is provided through the gtk-osx-users mailing list. I've copied the list with this reply, please be sure to "reply all" so that the list gets copies.

The stack trace appears to show that a formerly hidden menu item is being un-hidden, and the index is a negative number.. It's a very deep trace, though, and further down there was a collection of gtk_ui_manager_remove_ui.. Could it be that your code is trying to unhide a menu item that's been deleted?

I think that to understand what's going on you're going to have to do a debug build and debug the crash. You could start by setting a conditional breakpoint on the insertItem: atIndex: call in GNSMenuItem unhide, conditional on index < 0. You'll then be able to see which menu item is causing the problem and figure out its history and why it thinks it has a negative index.

Regards,
John Ralls





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]