mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: fixed crash when releasing NVMe interface
This commit is contained in:
@@ -166,14 +166,22 @@ internal class CapacityReader: Reader<Disks> {
|
||||
|
||||
var result = IOCreatePlugInInterfaceForService(disk, kIONVMeSMARTUserClientTypeID, kIOCFPlugInInterfaceID, &pluginInterface, &score)
|
||||
guard result == kIOReturnSuccess else { return nil }
|
||||
defer { IODestroyPlugInInterface(pluginInterface) }
|
||||
defer {
|
||||
if pluginInterface != nil {
|
||||
IODestroyPlugInInterface(pluginInterface)
|
||||
}
|
||||
}
|
||||
|
||||
result = withUnsafeMutablePointer(to: &smartInterface) {
|
||||
$0.withMemoryRebound(to: Optional<LPVOID>.self, capacity: 1) {
|
||||
pluginInterface?.pointee?.pointee.QueryInterface(pluginInterface, CFUUIDGetUUIDBytes(kIONVMeSMARTInterfaceID), $0) ?? KERN_NOT_FOUND
|
||||
}
|
||||
}
|
||||
defer { _ = pluginInterface?.pointee?.pointee.Release(smartInterface) }
|
||||
defer {
|
||||
if smartInterface != nil {
|
||||
_ = pluginInterface?.pointee?.pointee.Release(smartInterface)
|
||||
}
|
||||
}
|
||||
|
||||
guard result == KERN_SUCCESS, let smart = smartInterface?.pointee else { return nil }
|
||||
var smartData: nvme_smart_log = nvme_smart_log()
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>474</string>
|
||||
<string>476</string>
|
||||
<key>Description</key>
|
||||
<string>Simple macOS system monitor in your menu bar</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
|
||||
Reference in New Issue
Block a user