+++ This bug was initially created as a clone of Bug #3441 +++ While writing session support for an application, I noticed that after a successful SmcInteractRequest(), xfce session does not wait for a SmcInteractDone(), but instead terminates the program. If InteractRequest is invoked during the 2nd phase (from a SmcRequestSaveYourselfPhase2 handler), xfce session waits for InteractDone, but if the first shutdown is canceled, the second will destroy the application windows decorations, wait several seconds and then terminate. If this sounds unclear (my english is far from perfect), hopefully this will be easier: save_yourself_cb() -> SmcInteractRequest(handler) will not wait for <handler> to signal a SmcInteractDone() save_yourself_cb() -> SmcRequestSaveYourselfPhase2(save_phase_2_cb) save_phase_2_cb() -> SmcInteractRequest(handler) will wait for handler on the 1st shutdown, but if it's canceled \ will destroy window decorations and wait only several seconds on subsequent shutdown When the applications have no unsaved documents (and so don't call SmcInteractRequest) everything works fine. Reproducible: Always Steps to Reproduce: 1.Open any application like gedit, kwrite 2.Write something without saving 3.Logout from xfce Actual Results: Any unsaved files are lost. Expected Results: Wait for user to asnwer the Save: YNC questions.
Created attachment 1778 simple mousepad session interactivity demo This is a simple patch using the libxfcegui4 functions to add a Save: Yes|No|Cancel question to mousepad if the current file is not saved (doesn't save it, just a demo). The static client variable is only required to send a SmcInteractDone(sms_conn, True) on Cancel, since xfcegui4'libs session client doesn't support canceling a shutdown.
Ok, it looks like both of your problems were caused by the same thing, because xfce4-session uses the same (buggy) code when deciding whether or not each phase is finished... in that it doesn't check whether or not a client is interacting or waiting to interact. Anyhow, should be fixed in svn now.