Hi Andry,
You should create your TCanvas object in the heap (with new) instead
of in the stack. From the canvas, you try to delete a stack object.
Simply replace the line
TCanvas cnv("canvas", "Sample canvas", 400, 300);
by
TCanvas *cnv = new TCanvas("canvas", "Sample canvas", 400, 300);
Note also that you can eliminate many of the declarations and simply do:
#include <TROOT.h>
#include <TApplication.h>
#include <TCanvas.h>
TROOT Root("Temprature calculations", "TCalcROOT");
int main(int argc, char* argv[])
{
TApplication app("TCalc", &argc, argv);
TCanvas *cnv = new TCanvas("canvas", "Sample canvas", 400, 300);
app.Run(kTRUE);
return 0;
}
Rene Brun
Andriy Mykulyak wrote:
>
> Hello all,
>
> Maybe my question is a trivial one, but I'm a novice in ROOT, and
> don't understand what's wrong and how to deal with it.
>
> The program (see below) normally starts, crashes every time I
> choose 'Close Canvas' (not 'Quit ROOT') in the canvas menu. Why ?
>
> /*----------------------------------------------------------------*/
> #include <TROOT.h>
> #include <TApplication.h>
> #include <TCanvas.h>
>
> extern void InitGui();
> VoidFuncPtr_t initfuncs[] = {InitGui, 0};
>
> TROOT Root("Temprature calculations", "TCalcROOT", initfuncs);
>
> int main(int argc, char* argv[])
> {
> TApplication app("TCalc", &argc, argv);
> TCanvas cnv("canvas", "Sample canvas", 400, 300);
> app.Run(kTRUE);
> return 0;
> }
> /*--------------------------------------------------------------*/
>
> Thanks in advance,
>
> --
> Andriy Mykulyak.
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:37 MET