[GRASS-dev] [grass-code P][515] Close any open gis.m windows on GRASS exit

Maris Nartiss maris.gis at gmail.com
Fri Oct 19 10:01:16 EDT 2007


Hi Glynn.
Thanks for response. Some comments inline.
2007/10/19, Glynn Clements <glynn at gclements.plus.com>:
> > Initial Comment:
> > This patch does two things:
> > 1) Every gis.m app gets GRASS session ID encoded in it's name;
>
> Encoding the session PID in the application name prevents users from
> setting X resources specific to gis.m.
Well - this is true ONLY for first gis.m instance (per X user?). Wish
automatic adds #num to second gis.m instance (gm_tcl == first gis.m;
gm_tcl #2 = second one etc.). If setting those X resources is not done
by using wildcards (gm_tcl*), then this is problem also in current
implementation.

>
> I suggest moving the session check into gis.m itself, e.g. adding the
> following to gis.m:
Some EXIT procedure could be really good, as gis.m also could do some
stuff on exit i.e. ask to save current workspace (anyone interested in
it?) or offer to exit from whole grass, when called from GUI.

>
> 	proc exitif {session_id} {
> 		global env
> 		if {$env(GIS_LOCK) == $session_id} exit
> 	}
>
> and changing the init.sh code to:
>
> 	foreach gwin [lsearch -all -inline [winfo interps] gm_tcl*] {
> 		catch {send -async $gwin exitif $env(GIS_LOCK)}
> 	}
>
> > 2) On exit, all gis.m windows with current session ID gets closed.
> >
> > What needs to be tested:
> > what will happen on windows? Somebody with Cygwin and MinGW versions
> please test it.
>
> +	# [ $TCLTKGRASSBASE && !$MINGW && !$CGWIN ] - send does NOT work on
> windows.
>
> Note that send doesn't work on some current Linux systems either, due
> to X security mechanisms.
OK. Well - but it will work on some (mine ;) systems. IMHO wrapping
send with catch should prevent from any  bad side effects. For windows
there exists some dde mechanism instead of send, but as being lazy, I
have not implemented it. If somebody wants - go for it.

>
> --
> Glynn Clements <glynn at gclements.plus.com>

Thanks!

Maris.




More information about the grass-dev mailing list