Problem: 1382144

Title: (Files) TFile::Clone leaves bad AliasHandle in original TFile

Received: Aug 26 1996 9:31AM


TFile::Clone does not clone a file in Release 12, and causes a program break during a debug build. Since TFile::Close was in Release 11 (but broken) and Release 12 is only supposed to be a fix-it release, I suggest that we put a fixed version of it in Release 12 and defer the removal of it until Release 13.

I think it may be a problem to dispose the alias handle in TFile::Clone(). After calling inherited::Clone(), the aClonedFile->fAlias == this->fAlias. If we dispose the aClonedFile->fAlias, that means we dispose the original one too (this->fAlias, include alias record). That's incorrect. So it may be changed to:

TObject* TFile::Clone()
{
    TFile* aClonedFile = (TFile*)inherited::Clone();
    if (aClonedFile->fAlias)
        ::FailOSErr(GetAlias(aClonedFile->fAlias));
    return aClonedFile;
}

Fix:

Modified UFile.cp as recommended.