fix(qt): MainThreadMarker comes from objc2-foundation in this generation

The Mac build caught it on the first try, which is exactly what it was for:
`use objc2::MainThreadMarker` does not resolve — in the objc2 0.5 /
objc2-foundation 0.2 generation the type is exported by FOUNDATION
(objc2-foundation-0.2.2/src/lib.rs:152, ungated); it only moved to the objc2
root later. The reference imports it from the same place
(crates/qbz/src/tray/macos.rs:38), which is where this should have been read
from in the first place rather than assumed from a newer API.

The direct `objc2` dependency goes with it: nothing here names a type from
that crate.

cc
This commit is contained in:
vicrodh committed 2026-08-04 16:37:30 -06:00
1 parent 3b3ff54964
commit 1b18adcde0
3 files changed
+13 -3

No files matched your search

+1 -1
View File
@@ -6624,8 +6624,8 @@ dependencies = [
"ksni",
"libc",
"log",
"objc2 0.5.2",
"objc2-app-kit 0.2.2",
"objc2-foundation 0.2.2",
"open",
"qbz-app",
"qbz-audio",
+7 -1
View File
@@ -172,7 +172,13 @@ cxx-qt-build = "0.7"
# behind cfg, so `cargo build` cannot see it. First real check is a macOS
# build — the Mac mini (192.168.0.69) is where that happens.
[target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.5"
# `MainThreadMarker` — in THIS generation it is exported by objc2-foundation,
# not by the objc2 root (objc2-foundation-0.2.2/src/lib.rs:152, ungated). The
# reference imports it from the same place. There is no direct `objc2`
# dependency because nothing here names a type from it.
objc2-foundation = { version = "0.2", default-features = false, features = [
"std",
] }
objc2-app-kit = { version = "0.2", default-features = false, features = [
"std",
# NSApplication: the class and `setActivationPolicy`.
+5 -1
View File
@@ -183,8 +183,12 @@ pub(crate) fn handle() -> Option<&'static TrayHandle> {
/// reference's own `tray::set_mac_dock_hidden` (`tray/mod.rs:285-291`).
#[cfg(target_os = "macos")]
pub(crate) fn set_mac_dock_hidden(hidden: bool) {
use objc2::MainThreadMarker;
// `MainThreadMarker` lives in objc2-FOUNDATION in the 0.2/0.5 generation,
// not at the objc2 root — that is where it moved later. The reference
// imports it from exactly here (crates/qbz/src/tray/macos.rs:38), and a
// Mac build caught the wrong path on the first try.
use objc2_app_kit::{NSApplication, NSApplicationActivationPolicy};
use objc2_foundation::MainThreadMarker;
let Some(mtm) = MainThreadMarker::new() else {
log::warn!("[tray] dock policy skipped: not on the AppKit main thread");