I use XFce Desktop Environment on Gentoo GNU/Linux. Configuration and patches of used build of xfce-base/xfce4-session-4.10.1-r2 package can be seen at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/xfce-base/xfce4-session/ The issue is that on closing session XFce uses SIGTERM to terminate GUI applications. That is incorrect. FireFox browser provides the easiest way to see it (so you need previously to install it, I remember such behaviour since ESR 17, currently I use ESR 31): First time view normal mode: 1. Start FF; 2. Open some pages (for example https://bugs.gentoo.org/ andhttps://bugzilla.xfce.org/); 3. Normally close window (with two tabs opened) via Ctrl-Q or Alt-F4, or mouse click on pictogram in window header; 4. Start FF again. 5. You'll see the normal start according to browser settings. After that we can reproduse the issue: 1. Start FF again (if not started); 2. Open some pages (same as listed or others on your taste); 3. Execute XFce menu's logout (or reboot or poweroff) command (save session checkbox should be selected); 4. Re-login. 5. FF together with other X11 applications will be saved into session list and auto-started. 6. But. After FF started, it will show NOT result of ordinar start (seen at 5 step of previous demo), but error tab with broken session list. The same result you'll get if, after starting FF you'll start terminal, using ps command get the FF pid and send it SIGTERM signal. xfce-session should first time try to close window normally (similiarly with Ctrl-Q and Alt-F4 actions), and only after a control timeout send the rest of them first SIGTERM and finally SIGKILL signals. Probably (I'm not familiar with X11 programming) it should be XDestroyWindow function: http://www.x.org/releases/X11R7.7/doc/man/man3/XDestroyWindow.3.xhtml Finally, with the example FF browser: if opened many windows and tabs, sometimes normal close doesn't fit in default timeout (and XFce echoes no-responce error window, but some seconds later normal terminate succeed, destroing also error window. So it will be fine, if user's sessings will allow to configure value of this timeout: how much time application should have for normal termination, before sending SIGTERM signal.
Same for Firefox and some other programs. For instance, Geany do not save anything (opened tabs, recent list) when closing by xfce, so I had to close Geany/FF manually before logout/reboot. Here's another associated problem – most GUI programs do not ask anything (e.g. about unsaved documents) when killed by SIGTERM, so may lead to loss of data. As for my opinion, desired behaviour is attempt to close top-level windows – instead of killing relevant processes.
Related question about handling of unsaved documents. Starting with mousepad see bug #12300
Closing old bugs