Crash on saving

Crash on saving - Improper saving when opening files from forum - Messages

#1 Posted: 2/20/2018 5:33:48 AM
MBe

MBe

2 likes in 21 posts.

Group: User

Hello to Everybody,

I just noted a strange behaviour of Smath, I am using release 99.6622 but I believe it is the same in other versions.
If you open a file on the fly (without downloading) from an external source (i.e.: Smath Forum) and then you make any change to it, when you close the file you are prompted with a request to save the file.
If you (improperly) answer "Yes", Smath crashes.
I think Smath is right in the sense that you shouldn't save to a read-only location, but for the sake of completeness, you might want to protect against improper use from inexperienced users...

Thanks for the attention
Marco
#2 Posted: 2/20/2018 6:30:46 AM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Grazie Marco

Bug confirmed (unhandled System.UnauthorizedAccessException).

Guess the right way is:
1) check for permissions
2) If permissions are denied, prompt the "save as" dialog;
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Posted: 2/21/2018 3:51:39 AM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3732 posts.

Group: Super Administrator

Hello, Davide.

I've made some improvements to saving logic. Please could you check the same scenario with latest sources?
Unfortunately I'm unable to reproduce this issue.

Thanks in advance!
#4 Posted: 2/21/2018 4:50:57 AM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Hello Andrey,

Not fixed with your improvements. To reproduce simply mark a file as readonly from the system file properties before opening it with SS.

In my sandbox folder there is a possible solution
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 users liked this post
Andrey Ivashov 2/21/2018 4:29:00 PM
#5 Posted: 2/21/2018 12:01:26 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Hello to Everybody,

I just noted a strange behaviour of Smath, I am using release 99.6622 but I believe it is the same in other versions.
If you open a file on the fly (without downloading) from an external source (i.e.: Smath Forum) and then you make any change to it, when you close the file you are prompted with a request to save the file.
If you (improperly) answer "Yes", Smath crashes.
I think Smath is right in the sense that you shouldn't save to a read-only location, but for the sake of completeness, you might want to protect against improper use from inexperienced users...

Thanks for the attention
Marco



Hello Marco,

Superb description, the missing link is that if you save from open on the fly,
good thing Smath crashes ... What ! Yes What, how Smath knows where to save ?
Back to originator ... no way. Why not Save as ...
Have you tried copy/paste on new sheet => Save as in some addressed location ?

Jean

#6 Posted: 2/21/2018 3:15:13 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Wrote

Yes What, how Smath knows where to save ?
Back to originator ... no way. Why not Save as ...



This is not a big deal, the file downloaded for reading is stored in a temporary path and flushed when you close the browser, Smath knows the path and since is a temp folder can write in it . But the downloaded file it is set as read-only and can't be overwritten (this is not handled, hence the crash); best way from my point of view is to simply prompt the "save as" dialog that is opened on the default location; this it works on any read-only file, and you can still get an error messsage from the system if you try to overwrite the file from within the dialog.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#7 Posted: 2/21/2018 3:31:34 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3732 posts.

Group: Super Administrator

Thank you very much Davide!

I've taken your fix as a basis and extended it to support all possible places where saving to file may be called (i.e. desktop UI, silent mode, etc.). So, this is done now.

Best regards.
1 users liked this post
Davide Carpi 2/21/2018 3:33:00 PM
#8 Posted: 2/21/2018 4:29:06 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3732 posts.

Group: Super Administrator

FYI: Fix is a part of just released nightly build: https://en.smath.info/forum/yaf_postst12549_SMath-Studio-0-99-6626--21-February-2018.aspx
1 users liked this post
Davide Carpi 2/22/2018 8:39:00 PM
  • New Posts New Posts
  • No New Posts No New Posts