wizard: copy/restore storage when stepping through the wizard
When interacting with wizard, there is a single shared storage instance. If you go down the tree of dialogs, press "back" a couple times, go down another branch of dialogs, etc, there are side-effects on storage, which are never undone. fixes #5057 fixes #4496
This commit is contained in:
@@ -101,6 +101,20 @@ class JsonDB(PrintError):
|
||||
self.modified = True
|
||||
self.data.pop(key)
|
||||
|
||||
def get_all_data(self) -> dict:
|
||||
with self.db_lock:
|
||||
return copy.deepcopy(self.data)
|
||||
|
||||
def overwrite_all_data(self, data: dict) -> None:
|
||||
try:
|
||||
json.dumps(data, cls=util.MyEncoder)
|
||||
except:
|
||||
self.print_error(f"json error: cannot save {repr(data)}")
|
||||
return
|
||||
with self.db_lock:
|
||||
self.modified = True
|
||||
self.data = copy.deepcopy(data)
|
||||
|
||||
@profiler
|
||||
def write(self):
|
||||
with self.db_lock:
|
||||
|
||||
Reference in New Issue
Block a user