Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CRITICAL] Autosave does not correctly save NBS files on the latest build (v3.11 beta 2) #460

Open
CreeperPookie opened this issue Jul 20, 2024 · 2 comments
Assignees
Labels
C: Bug Something isn't working

Comments

@CreeperPookie
Copy link

CreeperPookie commented Jul 20, 2024

Describe the bug
After updating to the latest build I noticed some of my NBS files were mysteriously vanishing; at first, I thought this was probably some problem with my computer but even after fresh installing Windows I was still getting this problem (had to do with another issue)

To Reproduce
Steps to reproduce the behavior:

  1. Open any song on the latest build, and make sure autosave is enabled
  2. Make unsaved changes to the song, but don't manually save
  3. Wait for autosave to attempt to "save" the changes
  4. Note how even at 0 minutes remaining to auto save it does not save the file, and will even continue to tick lower into the negatives

Expected behavior
The expected behavior would be the same as what OpenNBS did in the previous builds, or to save normally when the autosave counter hits 0; and to reset the counter when autosaving.

Screenshots
This is a screenshot of a NBS window with the counter and being at in incorrect state, and with window title too so the unsaved marker * is also visible.
image

Additional context
If it were just a simple autosave bug I wouldn't consider this as so important; the problem is that in this state it kind of literally unsaves the actual file, and you may be able to see this if you open an explorer window in the folder the NBS file is saved in; for me it literally blinks in and out of existance as if it was being deleted and being recreated. Even worse, I've personally experienced the file being completely deleted because of this for at least 2 different NBS files; I don't know why the files get removed, especially as saving doesn't usually imply deleting the file, but in either case this makes the current build very unsafe to use, which might especially be true if you listen to songs in edit mode. I did test v3.10.0 and I can confirm autosave works normally; however I did test v3.10.0 beta 1 and I can confirm it also has this bug too.

@Bentroen
Copy link
Member

Thanks for reporting the issue!

This is the bit of logic that actually saves the file when the auto-save counter drops to 0:
https://github.com/OpenNBS/OpenNoteBlockStudio/blob/v3.11.0-beta.2/scripts/control_draw/control_draw.gml#L88-L92

The problem at play here is that the auto-save counter is never reset once the file is actually saved. So the counter keeps ticking down and, due to the <= bit at the logic above, the file gets saved to disk 60 times per second (or whatever your FPS setting happens to be set to).

This line:
https://github.com/OpenNBS/OpenNoteBlockStudio/blob/v3.11.0-beta.2/scripts/save_song/save_song.gml#L124
is not being run for some reason, which is the culprit. I'll make sure to investigate this for the next 3.11 beta.

@Bentroen Bentroen added the C: Bug Something isn't working label Jul 31, 2024
@Bentroen Bentroen self-assigned this Jul 31, 2024
@Bentroen
Copy link
Member

Bentroen commented Aug 9, 2024

The bug was introduced in commit 52144ea. Auto-save now saves the file in "backup mode" which saves the file silently, without adding it to recent songs and without resetting the auto-save timer. Should be an easy fix :)

IoeCmcomc added a commit to IoeCmcomc/OpenNoteBlockStudio that referenced this issue Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants