guillaumechereau / goxel

Goxel: Free and Open Source 3D Voxel Editor
GNU General Public License v3.0
2.74k stars 219 forks source link

Warn of unsaved file on exit #246

Closed hellocatfood closed 3 years ago

hellocatfood commented 3 years ago

Can a warning be added if a file is about to be closed without changes being saved? Currently if a user closes a file without saving (either via File > Quit or Alt + F4) the program will just close with no warning.

Although users should be saving regularly a warning could prevent accidental losses.

hellocatfood commented 3 years ago

I've just seen that #236 addresses this. Can it be merged?

guillaumechereau commented 3 years ago

Right, I didn't realize a PR was made for that. I will check it out.

guillaumechereau commented 3 years ago

I ended up writing a simpler implementation of the same feature.

hellocatfood commented 3 years ago

ok great, I'll try it out!

just fyi there's a PR which I think addresses the obj exporting request if you haven't seen it

hellocatfood commented 3 years ago

Works great, thanks

hellocatfood commented 3 years ago

I've just tried this again and it appears to be warning of unsaved changes even if I've just saved a document

Black-Cat commented 3 years ago

https://github.com/guillaumechereau/goxel/pull/236/files#diff-32b44c14f3e115731766a82eda708503fa162f9be89a98891fc1d63dcfbf1e80L729-L733 https://github.com/guillaumechereau/goxel/pull/236/files#diff-32b44c14f3e115731766a82eda708503fa162f9be89a98891fc1d63dcfbf1e80L748-L751

this changes should fix warning for saved documents

guillaumechereau commented 3 years ago

You are sure there is this problem? How do you reproduce it?

hellocatfood commented 3 years ago

Yes, definitely. Steps to reproduce:

I'm using commit #2737806 on Ubuntu 21:04

hellocatfood commented 3 years ago

I did a short recording of the issue so you can see it in action

https://user-images.githubusercontent.com/151947/124617704-0e71b080-de6f-11eb-83c4-956c8570e551.mp4

guillaumechereau commented 3 years ago

OK I see. It happens after the second save.. I don't really understand the code of the PR you linked. To me it seems that the bug is that the image 'save_key' is not properly updated. I'll look into that.

guillaumechereau commented 3 years ago

OK my last commit should fix that. Hopefully without any regression...

hellocatfood commented 3 years ago

Seems to work! I'll reopen again if I notice anything wrong.

@Black-Cat did you PR do anything different?

Black-Cat commented 3 years ago

no, same fix and there are no more differences except cosmetic ones