Canvas remains displayed after program is breaked

I need to visualise canvas as the program goes on:

TApplication app(“myapp”, 0, 0);


TCanvas canvas;
histo.Draw();
canvas.Update();
canvas.Modified();
\\point B
getchar();

I run a binary. Sometimes I need to break the program (Ctrl-C) at point B. In that case the canvas remains displayed and no longer can be closed. After many such iterations there is already a heap of non-closable canvases on display.

How to solve this problem?

Try to call gSystem->Exit(0, kTRUE); or gSystem->Exit(0, kFALSE); or gSystem->Abort(0);.

Coyote, I run a binary. After having terminated the executable I cannot invoke any ROOT commands.

{
  switch ( getchar() ) {
  case 'q':
  case 'Q':
    gSystem->Exit(0, kTRUE);
  case 'e':
  case 'E':
    gSystem->Exit(0, kFALSE);
  case 'a':
  case 'A':
    gSystem->Abort(0);
  default:
    continue;
  }
}
1 Like

In the case I have not yet implemented your solution, can I recognise the process of the “hanging” canvas at top with the intention to use pkill?

Instead of Ctrl-C, try Ctrl-Z and then, in the same (x)terminal window, execute kill %[%+-123...] or even kill -9 %[%+-123...] (search for “jobspec” and/or “job specification” in “man bash”).

1 Like

what is the meaning of %-1?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.