How to delete a latex

I use

  TLatex * latex_temp = new TLatex();
  latex_temp->DrawLatex(0.02, 0.78, "this is a test");

to draw some words on a canvas. Then I want to remove them from the canvas (to create an animation effect). How can I do that? I tried “delete latex_temp;”, it cannot remove latex words drawn even I update/modify canvas. Any hint? Thanks.


Please read the doc of Drawlatex. The function returns the pointer to the internally created object.


Great! I see. I should delete the copied pointer. Works! Thank you.