File Save dialog in ctrlr 5.6.23 #379
-
Has anyone successfully managed to save a binary file from ctrlr 5.6.23? I'm trying to save a .json file and ctrlr crashes and takes down the host (VST Host) immediately after the file save dialog in finished (it does do the check for overwrite) and crashes before any of the checks for fileExists etc happen in my LUA code. This is my code. I indicate the crash position (as per the debugger stepping through this). The autosave method also crashes when I manually invoke it. The only difference is that we don't raise the file dialog. The path is programatically determined.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Is it possibly a pemissions or lack of Administrator priveledges issue? |
Beta Was this translation helpful? Give feedback.
-
OK, I think I solved this and another issue that turned out to be related. I had missed cleaning up a bit of code, so a value was being written into the table as nil. It turns out that trying to display nil in a text box, or saving it to a file crashes things badly (and in 5.6.23, there is no error catcher) Fixing this nil value fixed the problem, but I probably need to start puting more error catching in my code. This lead me down a little investigation that led me here https://www.tutorialspoint.com/lua/lua_error_handling.htm I think we should use assert and pcall a lot more often in our code. LUA doesn't seem to do everything in protected mode by default, and VST's don't seem to run in protected mode within VST hosts. So an error in our code can crash our host. pcall allows any LUA function to run in protected mode and allows us to throw custom errors, so as a worst case, it should just stop the function from running without crashing your LUA instance and more importantly the host. I'll also post this in a show and tell thread to make it easier for people to find. |
Beta Was this translation helpful? Give feedback.
OK, I think I solved this and another issue that turned out to be related.
I had missed cleaning up a bit of code, so a value was being written into the table as nil. It turns out that trying to display nil in a text box, or saving it to a file crashes things badly (and in 5.6.23, there is no error catcher) Fixing this nil value fixed the problem, but I probably need to start puting more error catching in my code.
This lead me down a little investigation that led me here
https://www.tutorialspoint.com/lua/lua_error_handling.htm
I think we should use assert and pcall a lot more often in our code. LUA doesn't seem to do everything in protected mode by default, and VST's don't seem to run in…