PDA

View Full Version : file lock bug


WarpEnterprises
3rd September 2003, 23:11
regarding this bug (https://sourceforge.net/tracker/?func=detail&atid=482673&aid=660798&group_id=57023) I think I have found the cause.
Can one of the experienced devs comment this?


AudioSourceAVI::~AudioSourceAVI() {
if (pAVIStream)
delete pAVIStream;

/*adding these 2 lines helps, it seems that this file handle is not released anywhere else. */
if (pAVIFile)
pAVIFile->Release();
}

Bidoche
3rd September 2003, 23:41
class AudioSourceAVI : public AudioSource {
private:
IAVIReadHandler *pAVIFile;
IAVIReadStream *pAVIStream;
IAVIReadHandler seems to be a COM object type from VFW.

Then it definitely should be pAVIStream->Release() and not delete


And for pAVIFile, you are right, it seems to be leaked.

Stupid bugs....
That's what smart pointers are for, think to release at your place...

Bidoche
3rd September 2003, 23:51
In fact, both are avisynth internals types. :p

IAVIReadStream is not ref counted so deletion must be just fine.
But IAVIReadHandler is ref counted, and should (very likely) be released at destruction.

sh0dan
4th September 2003, 11:12
Seems to make sense - I just wonder if this is the correct place to do it - or if it belongs in source.cpp (AviSource destructor). Any opinions?

Bidoche
4th September 2003, 14:28
And how will you access it from AviSource destructor ?