Re: closing a canvas using Motif interface

Rene Brun (Rene.Brun@cern.ch)
Mon, 05 Jan 1998 13:21:58 +0100


Pasha Murat wrote:

> Hello, happy new Year to everybody!
>
> I'm wondering if the following is a feature or something missing:
> Consider an interactively created canvas:
>
> root [0] TCanvas* c = new TCanvas("c","c",0,0,300,300);
>
> which is *closed* using Motif interface (File->Close Canvas from popup menu).
> In this case is not actually *deleted* and `c' object is still present in
> memory after the canvas is closed
>
> root [1] .g
> ... snip
> 0x104b7360 class TCanvas* c=0x103d6110
>
> However it doesn't seem to be possible (and also doesn's make much sense)
> to do anything with this object any more, for example:
>
> root [2] c->Print()
>
> *** Break *** segmentation violation
>
> If it doesnt' break anything it would be nice to have a canvas object deleted
> from memory any time the corresponding window is closed and disappears from
> the screen.
> Regards, Pasha.

The canvas object is effectively deleted when the canvas disappears
from the screen. However, the name of the pointer to the canvas "c"
is still in the CINT tables because it has been created as a global object
and it is still in the scope.
We could implement the logic in the TObject destructor to systematically
scan the list of CINT names .

Rene Brun