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

Broken on 10.9 #3

Closed
tresf opened this issue Jan 28, 2021 · 4 comments
Closed

Broken on 10.9 #3

tresf opened this issue Jan 28, 2021 · 4 comments

Comments

@tresf
Copy link
Contributor

tresf commented Jan 28, 2021

Testing this library against macOS 10.9, I get the following crash:

2021-01-28 15:37:19.534 java[541:2907] -[NSStatusItem button]: unrecognized selector sent to instance 0x7fb2c1cfb0f0
2021-01-28 15:37:19.535 java[541:2907] An uncaught exception was raised
2021-01-28 15:37:19.536 java[541:2907] -[NSStatusItem button]: unrecognized selector sent to instance 0x7fb2c1cfb0f0
2021-01-28 15:37:19.537 java[541:2907] (
	0   CoreFoundation                      0x00007fff8e140b06 __exceptionPreprocess + 198
	1   libobjc.A.dylib                     0x00007fff8e5553f0 objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff8e1d740a -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
	3   CoreFoundation                      0x00007fff8e12f02e ___forwarding___ + 414
	4   CoreFoundation                      0x00007fff8e12ee18 _CF_forwarding_prep_0 + 232
	5   jna286536894285511670.tmp           0x0000000180db5e74 ffi_call_unix64 + 76
	6   ???                                 0x00007fff57e107f8 0x0 + 140734667753464
)
2021-01-28 15:37:19.537 java[541:2907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSStatusItem button]: unrecognized selector sent to instance 0x7fb2c1cfb0f0'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff8e140b06 __exceptionPreprocess + 198
	1   libobjc.A.dylib                     0x00007fff8e5553f0 objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff8e1d740a -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
	3   CoreFoundation                      0x00007fff8e12f02e ___forwarding___ + 414
	4   CoreFoundation                      0x00007fff8e12ee18 _CF_forwarding_prep_0 + 232
	5   jna286536894285511670.tmp           0x0000000180db5e74 ffi_call_unix64 + 76
	6   ???                                 0x00007fff57e107f8 0x0 + 140734667753464
)

@dyorgio says:

The correct logic is:
if > 10.0 and < 10.10 then access image selector directly on statusitem instance, if >= 10.10 use button as bridge
in fact I believe that accessing image on 10.10 also works, is only deprecated

https://developer.apple.com/documentation/appkit/nsstatusitem/1524711-image?language=objc

@dyorgio
Copy link
Owner

dyorgio commented Jan 29, 2021

Please @tresf, can you confirm fix?

@tresf
Copy link
Contributor Author

tresf commented Jan 29, 2021

I think it will fix it but the version compare isn't working here:

public static boolean isStatusItemButtonSupported() {
return OS_VERSION.compareTo("10.10") >= 0;
}

@tresf
Copy link
Contributor Author

tresf commented Jan 29, 2021

Opened PR here to fix version compare. It's a crude parser, but it should fix the OS detection #4

@tresf
Copy link
Contributor Author

tresf commented Jan 29, 2021

Closed via 09cfc90 + #4.

@tresf tresf closed this as completed Jan 29, 2021
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

No branches or pull requests

2 participants