mirror of
https://github.com/atom/atom.git
synced 2026-01-15 01:48:15 -05:00
Be a little more defensive when retaining/releasing recovery files
This commit is contained in:
@@ -24,7 +24,12 @@ export default class FileRecoveryService {
|
||||
)
|
||||
this.recoveryFilesByFilePath.set(path, recoveryFile)
|
||||
}
|
||||
recoveryFile.retain()
|
||||
|
||||
try {
|
||||
recoveryFile.retain()
|
||||
} catch (err) {
|
||||
console.log(`Couldn't retain ${recoveryFile.recoveryPath}. Code: ${err.code}. Message: ${err.message}`)
|
||||
}
|
||||
|
||||
if (!this.observedWindows.has(window)) {
|
||||
this.observedWindows.add(window)
|
||||
@@ -39,7 +44,11 @@ export default class FileRecoveryService {
|
||||
didSavePath (window, path) {
|
||||
const recoveryFile = this.recoveryFilesByFilePath.get(path)
|
||||
if (recoveryFile != null) {
|
||||
recoveryFile.release()
|
||||
try {
|
||||
recoveryFile.release()
|
||||
} catch (err) {
|
||||
console.log(`Couldn't release ${recoveryFile.recoveryPath}. Code: ${err.code}. Message: ${err.message}`)
|
||||
}
|
||||
if (recoveryFile.isReleased()) this.recoveryFilesByFilePath.delete(path)
|
||||
this.recoveryFilesByWindow.get(window).delete(recoveryFile)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user