SetBatch causes different graphics output for pngs

I ran this “10-times-in-a-row” command several times (>30) . And I saw that it was not right 2 or 3 times over 300 (10x30). I did the test with ROOT 6 and ROOT 5.34. I did a change in TRootCanvas to improve this (I increased the Sleep time between the 2 ProcessEvents). After this change both ROOT 6 and ROOT 5.34 gave me a 100% success when I ran the “10-times-in-a-row” command 30 times with the X11 backend. I committed this change for both ROOT 6 and ROOT 5.34. I hope that will be 100% success for you also.

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();
   }

Thanks for your input. Your X11 server is slower to sync than mine it seems. I verified that this new way of doing it also works for me. It does. I also changed TASImage accordingly for consistency. I committed these change for both ROOT 6 and ROOT 5.34. Thanks for your help in the final tuning.