Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#1 | Link |
Registered User
Join Date: Jan 2012
Location: On the net
Posts: 76
|
AviSynth scripting language bug?
Has anyone noticed that if you call a function that throws an exception within a try block, all variables are wiped from the stack frame? I mean the entire stack frame is just gone, even in previous function scopes all the way to the top level. But if you throw an exception within the try block without creating another function scope, everything works fine.
Globals don't seem to be affected though. Here is an example: Code:
global output__junk = BlankClip(height=0, width=0, length=0) global output__filename = "output.log" function output(string s) { output__junk.WriteFileStart(output__filename, "s", append=true) return 1 } global g = "GLOBAL" l = "LOCAL" function fail { assert(false) } try { assert(false) } catch(e) {} try { output("g="+g) } catch(e) { output("g doesn't exist. "+e) } try { output("l="+l) } catch(e) { output("l doesn't exist. "+e) } try { fail } catch(e) {} try { output("g="+g) } catch(e) { output("g doesn't exist. "+e) } try { output("l="+l) } catch(e) { output("l doesn't exist. "+e) } l = "LOCAL" try { output("g="+g) } catch(e) { output("g doesn't exist. "+e) } try { output("l="+l) } catch(e) { output("l doesn't exist. "+e) } output("fn1") function fn1 { l1 = "LOCAL1" try { assert(false) } catch(e) {} try { output("g="+g) } catch(e) { output("g doesn't exist. "+e) } try { output("l1="+l1) } catch(e) { output("l1 doesn't exist. "+e) } } fn1 try { output("g="+g) } catch(e) { output("g doesn't exist. "+e) } try { output("l="+l) } catch(e) { output("l doesn't exist. "+e) } output("fn2") function fn2 { l1 = "LOCAL1" try { fail } catch(e) {} try { output("g="+g) } catch(e) { output("g doesn't exist. "+e) } try { output("l1="+l1) } catch(e) { output("l1 doesn't exist. "+e) } } fn2 try { output("g="+g) } catch(e) { output("g doesn't exist. "+e) } try { output("l="+l) } catch(e) { output("l doesn't exist. "+e) } Code:
g=GLOBAL l=LOCAL g=GLOBAL l doesn't exist. I don't know what "l" means (test.avs, line 23) g=GLOBAL l=LOCAL fn1 g=GLOBAL l1=LOCAL1 g=GLOBAL l=LOCAL fn2 g=GLOBAL l1 doesn't exist. I don't know what "l1" means (test.avs, line 49) g=GLOBAL l doesn't exist. I don't know what "l" means (test.avs, line 53) Strange bug, Mx Last edited by maxxon; 26th January 2012 at 09:52. Reason: Forgot to add another test case. |
![]() |
![]() |
Tags |
avisynth script, bug, try catch |
Thread Tools | Search this Thread |
Display Modes | |
|
|