Hi,
I’m having some trouble with TCanvas::SaveAs().
Please see the attached code – it simply draws an ellipse at every pixel of a canvas.
The width and height at the top of the code specify the canvas width and height in pixels. It works and saves properly at 500x500, but not, for example, at 700x700. I tried it a few times and it seems it segfaults at 554x554.
The canvas draws correctly at larger sizes if I don’t run it in batch mode and comment out the SaveAs() line at the end, and graphically Save As from the canvas instead.
Here is the segfault error (with SaveAs and at 700x700):
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007f702433c65e in waitpid () from /lib64/libc.so.6
#1 0x00007f70242ce609 in do_system () from /lib64/libc.so.6
#2 0x00007f70248b8fc7 in TUnixSystem::StackTrace() () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libCore.so
#3 0x00007f70248baf5c in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libCore.so
#4 <signal handler called>
#5 0x00007f701871288f in TASImage::DrawLineInternal(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libASImage.so
#6 0x00007f7018712f24 in TASImage::DrawPolyLine(unsigned int, TPoint*, char const*, unsigned int, TImage::ECoordMode) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libASImage.so
#7 0x00007f701a0553eb in TImageDump::DrawPS(int, double*, double*) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libPostscript.so
#8 0x00007f7019087e23 in TPad::PaintPolyLine(int, double*, double*, char const*) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libGpad.so
#9 0x00007f7018f5379b in TEllipse::PaintEllipse(double, double, double, double, double, double, double, char const*) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libGraf.so
#10 0x00007f70190a1cec in TPad::Paint(char const*) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libGpad.so
#11 0x00007f70190a0c5f in TPad::Print(char const*, char const*) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libGpad.so
#12 0x00007f70190a1855 in TPad::SaveAs(char const*, char const*) const () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libGpad.so
#13 0x00007f702078081c in ?? ()
#14 0x00007fff0d62e3b0 in ?? ()
#15 0x4076800000000000 in ?? ()
#16 0x3fe0000000000000 in ?? ()
#17 0x0000000007d13d10 in ?? ()
#18 0x000000000a0af750 in ?? ()
#19 0x00000000213d4aa9 in ?? ()
#20 0x0000000000000000 in ?? ()
===========================================================
The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5 0x00007f701871288f in TASImage::DrawLineInternal(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libASImage.so
#6 0x00007f7018712f24 in TASImage::DrawPolyLine(unsigned int, TPoint*, char const*, unsigned int, TImage::ECoordMode) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libASImage.so
#7 0x00007f701a0553eb in TImageDump::DrawPS(int, double*, double*) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libPostscript.so
#8 0x00007f7019087e23 in TPad::PaintPolyLine(int, double*, double*, char const*) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libGpad.so
#9 0x00007f7018f5379b in TEllipse::PaintEllipse(double, double, double, double, double, double, double, char const*) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libGraf.so
#10 0x00007f70190a1cec in TPad::Paint(char const*) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libGpad.so
#11 0x00007f70190a0c5f in TPad::Print(char const*, char const*) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libGpad.so
#12 0x00007f70190a1855 in TPad::SaveAs(char const*, char const*) const () from /cvmfs/cms.cern.ch/slc6_amd64_gcc491/lcg/root/6.02.00-odfocd5/lib/libGpad.so
#13 0x00007f702078081c in ?? ()
#14 0x00007fff0d62e3b0 in ?? ()
#15 0x4076800000000000 in ?? ()
#16 0x3fe0000000000000 in ?? ()
#17 0x0000000007d13d10 in ?? ()
#18 0x000000000a0af750 in ?? ()
#19 0x00000000213d4aa9 in ?? ()
#20 0x0000000000000000 in ?? ()
===========================================================
If you either change 700x700 to 500x500 and do
root -l -q -b test.C
OR remove the last SaveAs line and do
root -l test.C
instead, the code will not segfault, and the resulting canvas (in the latter case) can be saved graphically.
It also works fine if the first set of TEllipse code is removed, even at 700x700; and it also works fine if I save a PDF instead of a PNG or a JPG.
test.C (1.13 KB)