mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-06-28 05:29:29 +00:00
Fixes a crash triggered by test telemetry
This commit is contained in:
parent
e98e1fa0b8
commit
a14d02e20f
1 changed files with 14 additions and 3 deletions
|
|
@ -9,10 +9,21 @@ import OSLog
|
|||
/// is set to hide the dock icon.
|
||||
@MainActor
|
||||
final class DockIconManager: NSObject {
|
||||
private static let _shared = DockIconManager()
|
||||
private static var _shared: DockIconManager!
|
||||
|
||||
static var shared: DockIconManager {
|
||||
_shared
|
||||
/// Initialize the shared instance on the main thread.
|
||||
/// Must be called once during app startup before accessing shared.
|
||||
@MainActor
|
||||
static func initialize() {
|
||||
precondition(Thread.isMainThread, "DockIconManager must be initialized on main thread")
|
||||
precondition(_shared == nil, "DockIconManager.initialize() called multiple times")
|
||||
_shared = DockIconManager()
|
||||
}
|
||||
|
||||
/// Access the shared instance. Requires initialize() to be called first.
|
||||
nonisolated static var shared: DockIconManager {
|
||||
precondition(_shared != nil, "DockIconManager.initialize() must be called before accessing shared")
|
||||
return MainActor.assumeIsolated { _shared }
|
||||
}
|
||||
|
||||
private var windowsObservation: NSKeyValueObservation?
|
||||
|
|
|
|||
Loading…
Reference in a new issue