Skip to content

Commit 8b50ce9

Browse files
mpelekoppor
authored andcommitted
Shutdown previus AutosaveManager and BackupManager during SaveAs (#2994)
1 parent 143ac3d commit 8b50ce9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
3030
- We improved the duplicate checker such that different editions of the same publication are not marked as duplicates. [2960](https://github.com/JabRef/jabref/issues/2960)
3131

3232
### Fixed
33+
- We fixed a bug that leaves .sav file after SaveAs [#2947](https://github.com/JabRef/jabref/issues/2947)
3334
- We fixed the function "Edit - Copy BibTeX key and link" to pass a hyperlink rather than an HTML statement.
3435
- We fixed the adding of a new entry from DOI which led to a connection error. The DOI resolution now uses HTTPS to protect the user's privacy.[#2879](https://github.com/JabRef/jabref/issues/2897)
3536
- We fixed the IEEE Xplore web search functionality [#2789](https://github.com/JabRef/jabref/issues/2789)

src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ public void saveAs() throws Exception {
316316
*/
317317
public void saveAs(File file) throws Exception {
318318
BibDatabaseContext context = panel.getBibDatabaseContext();
319-
319+
Path oldFile = context.getDatabasePath().get();
320+
320321
if (context.getLocation() == DatabaseLocation.SHARED) {
321322
// Save all properties dependent on the ID. This makes it possible to restore them.
322323
DBMSConnectionProperties properties = context.getDBMSSynchronizer().getDBProcessor()
@@ -334,8 +335,14 @@ public void saveAs(File file) throws Exception {
334335
if (!success) {
335336
return;
336337
}
337-
// Register so we get notifications about outside changes to the file.
338338

339+
//closing AutosaveManager and BackupManager for original library
340+
context.setDatabaseFile(oldFile.toFile());
341+
AutosaveManager.shutdown(context);
342+
BackupManager.shutdown(context);
343+
context.setDatabaseFile(file);
344+
345+
// Register so we get notifications about outside changes to the file.
339346
try {
340347
panel.setFileMonitorHandle(Globals.getFileUpdateMonitor().addUpdateListener(panel,
341348
context.getDatabaseFile().orElse(null)));

0 commit comments

Comments
 (0)