Dennis Nezic wrote:

> > > when i exit my wm (e16), since it doesn't (and shouldn't) close any
> > > other programs, gvim is stuck without an x server, and doesn't
> > > handle this loss gracefully. effectively, it's as if it was kill
> > > -9'ed ... and thus leaves temporary files behind, which i later
> > > have to labouriously clean up.
> > > 
> > > can it not do something better .... like simply close down if no
> > > changes were made to the file (and close any temp files). and, i
> > > guess, leave the temp files behind if changes were made (as it
> > > currently does in all cases :\).
> > 
> > Vim normally handles a shutdown of the window manager gracefully.
> > There is a protocol for this and Vim implements it.  This may result
> > in the window manager not exiting when Vim has modified files.
> > 
> > If you forcefully kill the window manager or the X server you will
> > get a hanging gvim (and possibly other programs).  That's your own
> > fault then.
> > 
> > If you shut down the window manager properly but Vim still hangs
> > somehow, perhaps the window manager doesn't work properly.  You could
> > try another one.
> 
> 
> The Rasterman seems to disagree. he responds as follows:
> 
> 
> > On Mon, 19 Jun 2006 10:53:32 +0900,
> > Carsten Haitzler (The Rasterman) <[EMAIL PROTECTED]> wrote:
> >
> > [...] there is no "shutdown protocol" for a wm - it doesn't
> > exist in x. read the icccm. there is a protocol a wm can use to
> > request an application to delete its window (and often apps will take
> > this as a hint and take their sweet time about it - sometimes pop up
> > "are you sure you want to exit?" dialogs etc.) but there is no
> > protocol to say "go shut down and cleanup ASAP and don't ask 'are you
> > sure?' etc.". if he is referring to a shutdown/save protocol in a
> > SESSION MANAGER (using libICE etc. etc.) THEN sure - there is one.
> > but not for window managers that don't pretend to be a session
> > manager too. my reply to enlightenment-users still stands. an app can
> > trap loss of x connection and still shut down gracefully (make it an
> > expedited shutdown with no "are you sure" dialogs - simply save and
> > clean up as fast as possible). e17 does just that itself as did e16.
> > they both handle loss of an x display themselves gracefully.
> > 
> > i bet you vim isn't setting its own handler for x io errors (which is
> > the handler called in this case, the default in xlib just calls exit
> > (), unless you set your own). fact is - gvim should also handle the
> > case where you ctrl+alt +backspace to kill x - and clean up, if it
> > can (which it can). the only case where gvim could not manage a
> > cleanup on shutdown is on a kill -9 as a process is killed off with
> > no choice in the matter.
> 
> he seems to have a good point. ?

How can you have a window manager without a session manager?  There must
be a session manager, otherwise the window manager can't gracefully
shutdown/logout.

Trapping X errors is very tricky, because it changes what library
functions do.  I have had lots of problems with it.  You can't simply
catch all X errors and have Vim exit, it would exit on simple errors.

Trapping the error that the X server has exited is like trapping the
error that the system crashes.  It's too late to do a graceful exit, you
can't ask the user what to do with changed text.  It will cause swap
files being left behind, thus the user will have to do crash recovery
afterwards.  It's only slightly better than "kill -9".

Vim does trap signals that makes it exit and tries to clean up properly.
I don't know what is actually happening in the situation that your X
server exists.  Doesn't Vim get a SIGHUP?  If you know what is going on
perhaps you can write a patch for this.  Be sure to test it on various
systems, not every X server works the same way, especially for these
unusual situations.

-- 
ARTHUR:        A scratch?  Your arm's off!
BLACK KNIGHT:  No, it isn't.
ARTHUR:        Well, what's that then?
BLACK KNIGHT:  I've had worse.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to