@@ -619,14 +619,16 @@ void TCanvas::Build()
619619 SetBatch (kTRUE );
620620 } else {
621621 // normal mode with a screen window
622- // Set default physical canvas attributes
623- fPainter ->SelectDrawable (fCanvasID );
624- fPainter ->SetAttFill ({1 , 1001 }); // Set color index for fill area
625- fPainter ->SetAttLine ({1 , 1 , 1 }); // Set color index for lines
626- fPainter ->SetAttMarker ({1 , 1 , 1 }); // Set color index for markers
627- // fPainter->SetAttText({22, 0., 1, 42, 12}); //Set color index for text
628- // Clear workstation
629- fPainter ->ClearWindow (fCanvasID );
622+ if (auto pp = GetCanvasPainter ()) {
623+ // Set default physical canvas attributes
624+ pp->SelectDrawable (fCanvasID );
625+ pp->SetAttFill ({1 , 1001 }); // Set color index for fill area
626+ pp->SetAttLine ({1 , 1 , 1 }); // Set color index for lines
627+ pp->SetAttMarker ({1 , 1 , 1 }); // Set color index for markers
628+ // pp->SetAttText({22, 0., 1, 42, 12}); //Set color index for text
629+ // Clear workstation
630+ pp->ClearWindow (fCanvasID );
631+ }
630632
631633 // Set Double Buffer on by default
632634 SetDoubleBuffer (1 );
@@ -662,8 +664,8 @@ void TCanvas::Build()
662664 SetPad (0 , 0 , 1 , 1 );
663665 Range (0 , 0 , 1 , 1 ); // pad range is set by default to [0,1] in x and y
664666
665- TVirtualPadPainter *vpp = GetCanvasPainter ();
666- if (vpp) vpp ->SelectDrawable (fPixmapID );// gVirtualX->SelectPixmap(fPixmapID); //pixmap must be selected
667+ if ( auto pp = GetCanvasPainter ())
668+ pp ->SelectDrawable (fPixmapID ); // pixmap must be selected
667669 PaintBorder (GetFillColor (), kTRUE ); // paint background
668670 }
669671
0 commit comments