mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix: trying to fix the crash by fixing some data racing in the widgets (#1578)
This commit is contained in:
@@ -162,10 +162,7 @@ open class Module: Module_p {
|
||||
|
||||
// load function which call when app start
|
||||
public func mount() {
|
||||
guard self.enabled else {
|
||||
return
|
||||
}
|
||||
|
||||
guard self.enabled else { return }
|
||||
self.readers.forEach { (reader: Reader_p) in
|
||||
reader.initStoreValues(title: self.config.name)
|
||||
reader.start()
|
||||
|
||||
@@ -158,15 +158,15 @@ open class WidgetWrapper: NSView, widget_p {
|
||||
public var type: widget_t
|
||||
public var title: String
|
||||
public var position: Int = -1
|
||||
|
||||
public var widthHandler: (() -> Void)? = nil
|
||||
|
||||
public var shadowSize: CGSize
|
||||
internal var queue: DispatchQueue
|
||||
|
||||
public init(_ type: widget_t, title: String, frame: NSRect) {
|
||||
self.type = type
|
||||
self.title = title
|
||||
self.shadowSize = frame.size
|
||||
self.queue = DispatchQueue(label: "eu.exelban.Stats.WidgetWrapper.\(type.rawValue).\(title)")
|
||||
|
||||
super.init(frame: frame)
|
||||
}
|
||||
@@ -372,6 +372,7 @@ public class MenuBar {
|
||||
private var moduleName: String
|
||||
private var menuBarItem: NSStatusItem? = nil
|
||||
private var active: Bool = false
|
||||
private var queue: DispatchQueue
|
||||
|
||||
private var combinedModules: Bool {
|
||||
Store.shared.bool(key: "CombinedModules", defaultValue: false)
|
||||
@@ -394,6 +395,7 @@ public class MenuBar {
|
||||
|
||||
init(moduleName: String) {
|
||||
self.moduleName = moduleName
|
||||
self.queue = DispatchQueue(label: "eu.exelban.Stats.MenuBar.\(moduleName)")
|
||||
self.oneView = Store.shared.bool(key: "\(self.moduleName)_oneView", defaultValue: self.oneView)
|
||||
self.view.identifier = NSUserInterfaceItemIdentifier(rawValue: moduleName)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user