Synchronize fs close

This commit is contained in:
crschnick 2024-05-15 09:01:04 +00:00
parent 6dd0e6d255
commit f4f3f21a70

View file

@ -100,25 +100,27 @@ public final class OpenFileSystemModel extends BrowserSessionTab<FileSystemStore
@Override
public void close() {
if (fileSystem == null) {
return;
}
if (DataStorage.get().getStoreEntries().contains(getEntry().get())
&& savedState != null
&& getCurrentPath().get() != null) {
if (getBrowserModel() instanceof BrowserSessionModel bm) {
bm.getSavedState()
.add(new BrowserSavedState.Entry(
getEntry().get().getUuid(), getCurrentPath().get()));
BooleanScope.execute(busy, () -> {
if (fileSystem == null) {
return;
}
}
try {
fileSystem.close();
} catch (IOException e) {
ErrorEvent.fromThrowable(e).handle();
}
fileSystem = null;
if (DataStorage.get().getStoreEntries().contains(getEntry().get())
&& savedState != null
&& getCurrentPath().get() != null) {
if (getBrowserModel() instanceof BrowserSessionModel bm) {
bm.getSavedState()
.add(new BrowserSavedState.Entry(
getEntry().get().getUuid(), getCurrentPath().get()));
}
}
try {
fileSystem.close();
} catch (IOException e) {
ErrorEvent.fromThrowable(e).handle();
}
fileSystem = null;
});
}
private void startIfNeeded() throws Exception {