SetBatch causes different graphics output for pngs

I play with “v5-34-00-patches" only and it seems I was able to “stabilize” it.

The original old source code of “TRootCanvas::SetWindowSize” failed in something like 40% of trials. After adding “gVirtualX->Update(1);”, it failed in something like 33% of trials. After “gSystem->Sleep(100);” modification, it failed in something like 27% of trials. So I tried “gSystem->Sleep(1000);” and it still failed in something like 15% of trials.

So, I decided to play with this myself and I have found a solution which seems to work:

   gVirtualX->Update(1);
   if (!gThreadXAR) {
      gSystem->Sleep(100); // at least 50; 100 is safer                         
      gSystem->ProcessEvents();
      gSystem->Sleep(10); // does not matter at all                             
      gSystem->ProcessEvents();
   }