View Single Post
Old 17th February 2012, 11:14   #294  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
I wrote a small application (full source) to view avs files, but it keeps crashing. I pasted the main part to http://pastebin.com/LB5fCTg5

My problem is cleaning the enviroment and rebuilding a new one.
If I loads a new file everything is fine, clip can be viewed without a problem.
To load another clip, I than first call m_env->DeleteScriptEnvironment(); (line 177) to clean up the old environment, initialize a new one (line 53), invoke the Import of the new clip (line 71) and try to call .asClip on the returned AVSValue; all like I did for the first clip. Problem is now the whole application comes crashing down.
To prevent this I added a few lines which check that the enviroment equals NULL before initializing it, problem is: How to do it properly such that I can kill the existing enviroment and set up a new?

Also how to I really delete the enviroment, calling DeleteScriptEnvironment() does not set it back to NULL and if I call delete m_env after calling DeleteScriptEnvironment() the application crashed,..

-> would be cool if someone who knows how to handle avisynth script environment stuff could have a look at it and tell me what I did wrong.
(it's probably something stupid that I missed )

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote