Thread: VirtualDub2
View Single Post
Old 23rd May 2017, 10:25   #270  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,316
Yes, but how do i put the code i need to run on "destructor" if i don't create the DeInit function ?
Because you musn't create your own constructor/destructor in your filter, because of the copy there is sometimes, so if you want a specific code to be run on constructor, you have to put it on Init function, but it's missing actualy a DeInit function to do the same thing.
Because of the interface, there is "copy constructor" operations on the instance filter, when you call the interface menu, etc. The existance of the Init function ensure that a specific constructor code will be run only once, and not several times, and the same with the DeInit.
You can't create/change the destructor (and also the constructor), to put your code, otherwise it will be called each time a copy of the object will be created.
There is the Init function for that for the constructor, but there is not such function for the destructor.
The value added by DeInit is to ensure that your code wil be runned only when the system will call FilterDeinit.
The same way Init ensure that your code wil be runned only when the system will call FilterInit.

Last edited by jpsdr; 23rd May 2017 at 10:30.
jpsdr is offline   Reply With Quote