Re: [gtk-osx-users] Using localization with "Application" menu with the gtk mac integration library.




On Oct 2, 2014, at 1:51 PM, Joshua Pettus <jshpettus gmail com> wrote:



Unfortunately that doesn’t tell me enough. Can you rebuild gtk-mac-integration with debug symbols and 
crash it again, please?
The easy way is to call setup_debug() before setup_sdk() in .jhbuildrc-custom and then run jhbuild 
buildone —force —clean gtk-mac-integration.


—enable-debug enough?


[SNIP]
Application Specific Information:
objc_msgSend() selector name: retain


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                   0x00007fff868fd097 objc_msgSend + 23
1   com.apple.CoreFoundation          0x00007fff883ea832 CFBundleCopyLocalizedString + 1506
2   com.apple.Foundation              0x00007fff927323eb -[NSBundle localizedStringForKey:value:table:] + 64

No, it’s not. I need the line number for this function:
3   libgtkmacintegration.2.dylib      0x00000001040d287b gtkosx_application_set_menu_bar + 810

[SNIP]

Interesting, though, that setting -enable-debug changes the offset and the selector that caused the crash.


That’s code in gtk-mac-integration; you’ll have to change it and rebuild gtk-mac-integration for it to do 
anything.


Sorry I wasn’t clear,  thats exactly what I did, then rebuilt xboard after.

It’s a shared library. No need to rebuild xboard. 

Anyway, try this with your modified GtkosxApplication.strings file:
diff --git a/src/gtkosxapplication_quartz.c b/src/gtkosxapplication_quartz.c
index d51298f..b718cd2 100644
--- a/src/gtkosxapplication_quartz.c
+++ b/src/gtkosxapplication_quartz.c
@@ -241,7 +241,7 @@ create_apple_menu (GtkosxApplication *self)
   [app_menu addItem: menuitem];
   [menuitem release];
   [app_menu addItem: [NSMenuItem separatorItem]];
-  menuitem = [[NSMenuItem alloc] initWithTitle: [[NSLocalizedStringFromTable (@"Hide",  
@"GtkosxApplication", @"Hide menu item title") autorelease] stringByAppendingFormat: @" %@", appname]
+  menuitem = [[NSMenuItem alloc] initWithTitle: [stringWithFormat: NSLocalizedStringFromTable (@"Hide",  
@"GtkosxApplication", @"Hide menu item title"), appname]]
              action: @selector (hide: ) keyEquivalent: @"h"];
   [menuitem setTarget: NSApp];
   [app_menu addItem: menuitem];
@@ -258,7 +258,7 @@ create_apple_menu (GtkosxApplication *self)
   [app_menu addItem: menuitem];
   [menuitem release];
   [app_menu addItem: [NSMenuItem separatorItem]];
-  menuitem = [[NSMenuItem alloc] initWithTitle: [[NSLocalizedStringFromTable (@"Quit",  
@"GtkosxApplication", @"Quit menu item title") autorelease] stringByAppendingFormat: @" %@", appname]
+  menuitem = [[NSMenuItem alloc] initWithTitle: [stringWithFormat: NSLocalizedStringFromTable (@"Quit %@",  
@"GtkosxApplication", @"Quit menu item title"), appname]]
              action: @selector (terminate: ) keyEquivalent: @"q"];
   [menuitem setTarget: NSApp];
   [app_menu addItem: menuitem];

Or this with the default one:
diff --git a/src/gtkosxapplication_quartz.c b/src/gtkosxapplication_quartz.c
index d51298f..a871b8f 100644
--- a/src/gtkosxapplication_quartz.c
+++ b/src/gtkosxapplication_quartz.c
@@ -241,7 +241,7 @@ create_apple_menu (GtkosxApplication *self)
   [app_menu addItem: menuitem];
   [menuitem release];
   [app_menu addItem: [NSMenuItem separatorItem]];
-  menuitem = [[NSMenuItem alloc] initWithTitle: [[NSLocalizedStringFromTable (@"Hide",  
@"GtkosxApplication", @"Hide menu item title") autorelease] stringByAppendingFormat: @" %@", appname]
+  menuitem = [[NSMenuItem alloc] initWithTitle: [NSLocalizedStringFromTable (@"Hide",  @"GtkosxApplication", 
@"Hide menu item title")] stringByAppendingFormat: @" %@", appname]
              action: @selector (hide: ) keyEquivalent: @"h"];
   [menuitem setTarget: NSApp];
   [app_menu addItem: menuitem];
@@ -258,7 +258,7 @@ create_apple_menu (GtkosxApplication *self)
   [app_menu addItem: menuitem];
   [menuitem release];
   [app_menu addItem: [NSMenuItem separatorItem]];
-  menuitem = [[NSMenuItem alloc] initWithTitle: [[NSLocalizedStringFromTable (@"Quit",  
@"GtkosxApplication", @"Quit menu item title") autorelease] stringByAppendingFormat: @" %@", appname]
+  menuitem = [[NSMenuItem alloc] initWithTitle: [NSLocalizedStringFromTable (@"Quit",  @"GtkosxApplication", 
@"Quit menu item title") stringByAppendingFormat: @" %@", appname]
              action: @selector (terminate: ) keyEquivalent: @"q"];
   [menuitem setTarget: NSApp];
   [app_menu addItem: menuitem];

And see if Kevin Bernhagen is right about the autorelease causing the crash.

Regards,
John Ralls





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