Is this a bug or is it something wrong with my code?

Modified from the tutorials directory, I have been trying to figure out for a couple of days how to draw a circle over an image, and this is what I got, modified from rose_image.C:

TCanvas *c1;
void rose_image()

TImage *img = TImage::Open(“rose512.jpg”);

c1 = new TCanvas(“rose512”, “examples of image manipulations”, 760, 900);

img->DrawLine(10,100,100,10, “#0000ff”, 0);

If I comment out DrawLine, I get a Bus error on my mac (OS X 10.4, intel, root 5.18, gcc 4.01), and on my ubuntu machine it doesn’t work either (Ubuntu Hardy, gcc 4.2.3, kernel 2.6.24-17, P4 Xeon). If I do DrawLine first, it works on both machines.

I read through the header file. I guess it wasn’t totally clear that I you have to initialize “img->BeginPaint();” in order to paint on the image. It makes sense, but I’m still a newbie.

Is there a reason some of the functions (like DrawLineInternal() ) initialize it and others do not?