[ROOT] TString::StrDup and MSVC

From: Axel Naumann (axel@fnal.gov)
Date: Mon May 28 2001 - 22:16:58 MEST


Hi,

Assume I execute a program built in debug mode, linked against the Root
debug libs for Win. I call TString::StrDup from within a TObject derived
class and delete [] it later on.

TString::StrDup calls ::new(), and aparently a different "version" of delete
is called from within a TObject derived class: I get an exception

HEAP[analyzeDbg.exe]: Invalid Address specified to RtlFreeHeap( 990000,
147bd40 )

(If you want to see that yourself: Run a program which links against the
Root libs with an object of type TApplication; in your
TApplication::TApplication the call
	if (fArgv) gSystem->SetProgname(fArgv[0]);
will be forwarded to TWinNTSystem which allocates
      if ( IsAbsoluteFileName(fullname) && !AccessPathName(fullname))
          which = StrDup(fullname);
and deletes
      if (which) delete [] which;
causing the exception to be thrown.)

Any idea why? Does the TObject::new/delete differ from ::new/::delete?

Cheers, Axel.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:47 MET