Re: [gtk-osx-users] Using localization with "Application" menu with the gtk mac integration library.
- From: Kevin Bernhagen <kevin calxalot net>
- To: John Ralls <jralls ceridwen us>
- Cc: Joshua Pettus <jshpettus gmail com>, "gtk-osx-users-list gnome org" <gtk-osx-users-list gnome org>
- Subject: Re: [gtk-osx-users] Using localization with "Application" menu with the gtk mac integration library.
- Date: Thu, 2 Oct 2014 13:56:11 -0700
If feel certain.
If most OSX frameworks, you don't own the returned object if the function/method used does not contain the
word "create", "copy", or "retained".
The crash report also mentions selector autorelease sent to address 0x18.
An autorelease is being sent to an already dealloc'd object.
On Oct 2, 2014, at 1:28 PM, John Ralls <jralls ceridwen us> wrote:
On Oct 2, 2014, at 1:20 PM, Kevin Bernhagen <kevin calxalot net> wrote:
You should not autorelease the return value from NSLocalizedStringFromTable.
OK. Do you think that might be the source of the crash in XBoard?
Regards,
John Ralls
On Oct 2, 2014, at 1:03 PM, Joshua Pettus <jshpettus gmail com> wrote:
Please copy the list on all replies; use “reply all” (the double-arrow).
Oops Sorry about that. :\
Please either open a bug with the stack trace of the crash or post it here; if you use the crash log you
please cut it off after the stack trace, as the hundred lines of dylib information just adds clutter. If
you can, please use a debug build of gtk-mac-integration and of your application so that the line numbers
are present in the stack trace.
Ok, interestingly enough, launching Xboard with the -debug flag avoids the crash and it looks like it
works via putting Xboard at the end. But the xboard debug log doesn’t say anything useful for this, and
is mostly for internal stuff xboard. Our coder, Harm Geert Muller, might know why this could be the case,
but he knows very little about OSX.
If it helps, the problem is avoided when we change the english input side of the string in those two areas
that will eventually have the application name with it.
Hide and Quit
But here is the crash log anway:
Process: XBoard-bin [74422]
Path: /Applications/Chess/*/XBoard.app/Contents/MacOS/XBoard-bin
Identifier: org.fsf.xboard.www
Version: master-20140119 (master-20140119)
Code Type: X86-64 (Native)
Parent Process: launchd [173]
Responsible: XBoard-bin [74422]
User ID: 501
Date/Time: 2014-10-02 15:43:50.993 -0400
OS Version: Mac OS X 10.9.5 (13F34)
Report Version: 11
Anonymous UUID: B5F105E8-A871-4B39-64DC-CA53CCBFDFF7
Sleep/Wake UUID: AE44AA16-3216-49DE-B4E9-AB60CE22E37F
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000018
VM Regions Near 0x18:
-->
__TEXT 0000000107687000-0000000107736000 [ 700K] r-x/rwx SM=COW
/Applications/Chess/*/XBoard.app/Contents/MacOS/xboard-bin
Application Specific Information:
objc_msgSend() selector name: autorelease
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff868fd097 objc_msgSend + 23
1 libgtkmacintegration.2.dylib 0x0000000108421852 gtkosx_application_set_menu_bar + 794
2 XBoard-bin 0x00000001077183cb GenericPopUp + 12221
3 XBoard-bin 0x00000001076fea9b BoardPopUp + 695
4 XBoard-bin 0x000000010770fe6a main + 3809
5 libdyld.dylib 0x00007fff90fc65fd start + 1
Thread 1:
0 libsystem_kernel.dylib 0x00007fff8f277e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff8caa5f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff8caa8fb9 start_wqthread + 13
Thread 2:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff8f278662 kevent64 + 10
1 libdispatch.dylib 0x00007fff91ff4421 _dispatch_mgr_invoke + 239
2 libdispatch.dylib 0x00007fff91ff4136 _dispatch_mgr_thread + 52
Thread 3:
0 libsystem_kernel.dylib 0x00007fff8f277e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff8caa5f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff8caa8fb9 start_wqthread + 13
Thread 4:
0 libsystem_kernel.dylib 0x00007fff8f277e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff8caa5f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff8caa8fb9 start_wqthread + 13
Thread 5:
0 libsystem_kernel.dylib 0x00007fff8f277e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff8caa5f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff8caa8fb9 start_wqthread + 13
Thread 6:
0 libsystem_kernel.dylib 0x00007fff8f277e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff8caa5f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff8caa8fb9 start_wqthread + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00007fff868fd1c4 rbx: 0x00007f8a50409f70 rcx: 0x00007fff75b8ecf0 rdx: 0x00007f8a50602c48
rdi: 0x00007f8a50602cc0 rsi: 0x00007fff8a68166e rbp: 0x00007fff58577c90 rsp: 0x00007fff58577c28
r8: 0x00007f8a50602cc0 r9: 0x00000001084278c8 r10: 0x00007fff8a68166e r11: 0x0000000000000000
r12: 0x0000000108427758 r13: 0x00007fff868fd080 r14: 0x0000000108427758 r15: 0x00007f8a504099c0
rip: 0x00007fff868fd097 rfl: 0x0000000000010246 cr2: 0x0000000000000018
Logical CPU: 1
Error Code: 0x00000004
Trap Number: 14
Menu items moved from other menus need to be translated in the application using whatever localization
scheme you use for the rest of the program; that’s normally gettext for Gtk applications.
Ok, thanks for clarifying that. It’s therefor on our end. :)
You can’t just change the keys in the strings. You also have to change the keys in the table lookup. For
example, the “Hide” lookup is at line 246 in gtkosxapplication_quartz.c:
menuitem = [[NSMenuItem alloc] initWithTitle: [[NSLocalizedStringFromTable (@"Hide",
@"GtkosxApplication", @"Hide menu item title") autorelease] stringByAppendingFormat: @" %@", appname]
action: @selector (hide: ) keyEquivalent: @"h”];
That’s not really the right way to do that, since it forces the app name to the end of the string. It
also won’t find the key “Hide % “ in your revised strings file. It needs to be something like (because I
haven’t tested it)
menuitem = [[NSMenuItem alloc] initWithTitle: [stringWithFormat: [NSLocalizedStringFromTable (@“Hide %@",
@"GtkosxApplication", @"Hide menu item title") autorelease], appname]
action: @selector (hide: ) keyEquivalent: @"h”];
Ah, makes sense. I tried compiling it with one then the other, which succeeded, and then rebuilt xboard.
Neither translated “Quit % “ or “Hide % “ It would be ideal to place the application name before or
after the string depending on the language.
Thank-you!
Josh Pettus
_______________________________________________
Gtk-osx-users-list mailing list
Gtk-osx-users-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-osx-users-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]