Re: ROOT incompatible with VC++ 6

From: Valery Fine (fine@bnl.gov)
Date: Fri Oct 02 1998 - 19:21:00 MEST


On 25 Sep 98 at 11:07, Andy Haas wrote:

> I've noticed that ROOT version 2.00/11 for WinNT has problems with
> the new MSVCRT.DLL distributed with VC++ 6.0 on NT. For instance,
> using the new dll, attempting to divide a canvas by right clicking
> and filling in arguments causes a crash in the dll. This happens
> many other places as well. 

 I think it is  ROOT "problem" rather the MS one.

 I can not check it myself, since I have no VC++ 6.0 but I hope the 
TPad::Divide can be changed as follows  and it will help
The soil of this correction is to try to avoid touching
the global variable <gPad> from the concurrent working threads.
(Very likely the MS VC++ 6.0 DLL works just faster then that old one)

//_______________________________
void TPad::Divide(Int_t nx, Int_t ny, Float_t xmargin, Float_t ymargin, Int_t color)
{
//VF 02/10/98   TPad *padsav = (TPad*)gPad;
//VF 02/10/98   cd();
   if (nx <= 0) nx = 1;
   if (ny <= 0) ny = 1;
   Int_t ix,iy;
   Float_t x1,y1,x2,y2;
   Float_t dy = 1/Float_t(ny);
   Float_t dx = 1/Float_t(nx);
   TPad *pad;
   char *name = new char [strlen(GetName())+6];
   Int_t n = 0;
   if (color == 0) color = GetFillColor();
   for (iy=0;iy<ny;iy++) {
      y2 = 1 - iy*dy - ymargin;
      y1 = y2 - dy + 2*ymargin;
      if (y1 < 0) y1 = 0;
      if (y1 > y2) continue;
      TList *primitives = GetListOfPrimitives();   // VF 02/10/98
      if (primitives ) {                           // VF 02/10/98 
        for (ix=0;ix<nx;ix++) {
           x1 = ix*dx + xmargin;
           x2 = x1 +dx -2*xmargin;
           if (x1 > x2) continue;
           n++;
           sprintf(name,"%s_%d",GetName(),n);
           pad = new TPad(name,name,x1,y1,x2,y2,color);
           pad->SetNumber(n);
           pad->SetMother(this);               // VF 02/10/98 we need new method: TPad::SetMother(TPad *pad){fMother =  pad;} 
           pad->setCanvas(GetCanvas());        // VF 02/10/98we need new method: TPad::SetCanvas(TPad *canvas){fCanvas =  canvas;}   
           primitives->Add(pad);
      }
   }
   delete [] name;
   Modified();
   Paint();                 // VF 02/10/98
// VF 02/10/98   padsav->cd();
}
=================================================================
Dr. Valeri Faine (Fine)
    -------------------          Phone: +1 516 344 7806
Brookhaven National Laboratory   FAX  : +1 516 344 4206
Bldg. 510A /STAR                 mailto:fine@bnl.gov
Upton, New York, 11973-5000      http://nicewww.cern.ch/~fine
USA
                                 
Dr. Valery Fine                  Telex : 911621 dubna su
    -----------
LCTA/Joint Inst.for Nuclear Res. Phone : +7 09621 6 40 80
141980 Dubna, Moscow region      Fax   : +7 09621 6 51 45
Russia                           mailto:fine@main1.jinr.dubna.su                              



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:38 MET