Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M1 Mac: Segfault using JNA to fix system tray icon #780

Closed
tresf opened this issue Mar 31, 2021 · 1 comment · Fixed by #783
Closed

M1 Mac: Segfault using JNA to fix system tray icon #780

tresf opened this issue Mar 31, 2021 · 1 comment · Fixed by #783

Comments

@tresf
Copy link
Contributor

tresf commented Mar 31, 2021

#745 fixes a scenario where the tray icon may be the wrong color however it introduces a new crash on OpenJDK 16 running natively on the M1 Mac.

Steps to reproduce:

  • Install homebrew on an M1 Mac
  • brew install openjdk
  • ant
  • $(brew --prefix openjdk)/bin/java -jar out/dist/qz-tray.jar
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000018999b0d8, pid=98331, tid=60991
#
# JRE version: OpenJDK Runtime Environment (16.0+14) (build 16+14)
# Java VM: OpenJDK 64-Bit Server VM (16+14, mixed mode, tiered, compressed oops, g1 gc, bsd-aarch64)
# Problematic frame:
# C  [libobjc.A.dylib+0x60d8]  objc_retain+0x8
[...]
Stack: [0x00000001732ac000,0x00000001734af000],  sp=0x00000001734ace90,  free space=2051k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libobjc.A.dylib+0x60d8]  objc_retain+0x8
C  [Foundation+0x522b4]  -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:]+0x88
C  [jna9974670173871136406.tmp+0x10044]  ffi_prep_closure_loc+0x198c
C  [jna9974670173871136406.tmp+0xe668]  ffi_call+0x500
C  [jna9974670173871136406.tmp+0x6760]  Java_com_sun_jna_Native_invokePointer+0x8f8
C  [jna9974670173871136406.tmp+0x6af8]  Java_com_sun_jna_Native_invokeLong+0x2c
j  com.sun.jna.Native.invokeLong(Lcom/sun/jna/Function;JI[Ljava/lang/Object;)J+0
j  com.sun.jna.Function.invoke([Ljava/lang/Object;Ljava/lang/Class;ZI)Ljava/lang/Object;+243
j  com.sun.jna.Function.invoke(Ljava/lang/reflect/Method;[Ljava/lang/Class;Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object;+271
j  com.sun.jna.Library$Handler.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;+390
j  com.sun.proxy.$Proxy11.objc_msgSend(Lcom/sun/jna/NativeLong;Lcom/sun/jna/Pointer;[Ljava/lang/Object;)Lcom/sun/jna/NativeLong;+24
j  org.dyorgio.jna.platform.mac.NSObject.performSelectorOnMainThread(Lcom/sun/jna/Pointer;Lcom/sun/jna/NativeLong;Z)V+29
j  org.dyorgio.jna.platform.mac.FutureTaskCallback.performOnMainThread(Ljava/util/concurrent/FutureTask;Z)V+13
j  org.dyorgio.jna.platform.mac.FoundationUtil.runOnMainThread(Ljava/lang/Runnable;Z)Ljava/util/concurrent/FutureTask;+12
j  org.dyorgio.jna.platform.mac.FoundationUtil.runOnMainThreadAndWait(Ljava/lang/Runnable;)V+2
j  qz.utils.MacUtilities.toggleTemplateIcon(Ljava/awt/TrayIcon;)V+249
j  qz.common.TrayManager.lambda$setDefaultIcon$11()V+7
j  qz.common.TrayManager$$Lambda$368+0x000000030048d6d0.run()V+4
j  qz.common.TrayManager.lambda$refreshIcon$12(Ljava/lang/Runnable;)V+30
j  qz.common.TrayManager$$Lambda$369+0x000000030048d8f0.run()V+8
j  java.awt.event.InvocationEvent.dispatch()V+47 java.desktop@16
j  java.awt.EventQueue.dispatchEventImpl(Ljava/awt/AWTEvent;Ljava/lang/Object;)V+21 java.desktop@16
j  java.awt.EventQueue$4.run()Ljava/lang/Void;+32 java.desktop@16
j  java.awt.EventQueue$4.run()Ljava/lang/Object;+1 java.desktop@16
J 1264 c1 java.security.AccessController.executePrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/lang/Class;)Ljava/lang/Object; java.base@16 (65 bytes) @ 0x000000010ee2e964 [0x000000010ee2e800+0x0000000000000164]
j  java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;+13 java.base@16
j  java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;+18 java.base@16
j  java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+46 java.desktop@16
j  java.awt.EventDispatchThread.pumpOneEventForFilters(I)V+78 java.desktop@16
j  java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+35 java.desktop@16
j  java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11 java.desktop@16
j  java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4 java.desktop@16
j  java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3 java.desktop@16
j  java.awt.EventDispatchThread.run()V+9 java.desktop@16
v  ~StubRoutines::call_stub
V  [libjvm.dylib+0x44ae78]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x30c
V  [libjvm.dylib+0x449f14]  JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, Thread*)+0x11c
V  [libjvm.dylib+0x449fe0]  JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, Thread*)+0x64
V  [libjvm.dylib+0x4f94d0]  thread_entry(JavaThread*, Thread*)+0xc4
V  [libjvm.dylib+0x947620]  JavaThread::thread_main_inner()+0xb0
V  [libjvm.dylib+0x945194]  Thread::call_run()+0x88
V  [libjvm.dylib+0x786cd8]  thread_native_entry(Thread*)+0x16c
C  [libsystem_pthread.dylib+0x706c]  _pthread_start+0x140
@tresf
Copy link
Contributor Author

tresf commented Mar 31, 2021

Upstream bug filed:
dyorgio/macos-tray-icon-fixer#5

Temporary workaround (disables the new icon support):
https://github.com/qzind/tray/tree/m1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant