mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
undo: Clear undo stack on file close
The undo stack is only relevant to the dives that were loaded at the time the command was executed. If a file is closed, by specifically closing it or opening another file, then the undo commands will reference dives that aren't available anymore. Clearing the undo stack ensures that we don't crash or accidentally do some undefined modifications to the currently open file. Signed-off-by: Michael Andreen <michael@andreen.dev>
This commit is contained in:
parent
ada4632ff1
commit
be2bdb8650
3 changed files with 3 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
- Desktop: Allow more than one media file to be imported from web
|
||||
- undo: Clear undo stack when the current file is closed
|
||||
---
|
||||
* Always add new entries at the very top of this file above other existing entries and this note.
|
||||
* Use this layout for new entries: `[Area]: [Details about the change] [reference thread / issue]`
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include "command.h"
|
||||
#include "command_base.h"
|
||||
#include "core/globals.h"
|
||||
#include "core/qthelper.h" // for updateWindowTitle()
|
||||
|
@ -18,6 +19,7 @@ void init()
|
|||
{
|
||||
undoStack = make_global<QUndoStack>();
|
||||
QObject::connect(undoStack, &QUndoStack::cleanChanged, &updateWindowTitle);
|
||||
QObject::connect(&diveListNotifier, &DiveListNotifier::dataReset, &Command::clear);
|
||||
changesCallback = &changesMade;
|
||||
}
|
||||
|
||||
|
|
|
@ -513,7 +513,6 @@ void MainWindow::closeCurrentFile()
|
|||
if (!existing_filename)
|
||||
setTitle();
|
||||
disableShortcuts();
|
||||
Command::setClean();
|
||||
}
|
||||
|
||||
void MainWindow::updateCloudOnlineStatus()
|
||||
|
|
Loading…
Reference in a new issue