So I've found that actually
- imsettings-lxde (1.6.8) calls "lxsession -r" when "sGtk/IMModule" is changed
(when imsetting is to change the value) in .config/lxsession/LXDE/desktop.conf
- Then even the current "/usr/bin/lxsession -s LXDE -e LXDE" session terminates
Happening on lxsession 0.5.2.
gdb attached.
- Firstly, login. Once imsettings-lxde is removed. login now successes
- On terminal, launch gdb, attach to the current lxsession, add
breakpoint on "exit()"
- Back to the GUI, launch a terminal, then call "lxsession -r"
- Then the current lxsession process terminates.
By the way, trying to debug this, I came to wonder what "cb_data" in
lxsession 0.5.2 source code does.
When watching lxsettings-daemon/xsettings-manager.c xsettings_manager_new(),
it sets "cb_data" being passed as an argument to "manager->cb_data", then
return manager (manager itself is malloc() ed).
But when trying to see the call of xsettings_manager_new(), it is called
in create_xsettings_managers(), however the cb_data argument passed to
xsettings_manager_new() is actually &terminated, and terminated is in-function
auto, non-static variable. Is this valid?
Also terminate_cb() calls exit() when *data at input is false, however
currently I cannot figure out where cb_data is set to be true.
Sorry if I am wrong.
Well, with lxsession-0.4.6.1, "lxsession -r" does not terminate
the existing lxsession process, and the "lxsession -r" process
immediately terminates at main() function
(after send_internal_command(LXD_RELOAD)), so with
lxsession-0.4.6.1, "lxsession -r" seems no problem.
However with lxsession 0.5.2, "main" file is now written in vala and
largely differ from lxsession-0.4.6.1...
For the present, the attached patch restores the behavior
what "lxsession -r" was doing on 0.4.6.1.
Well, actually the patch caused https://sourceforge.net/p/lxde/bugs/818/ .
The problem with the previous patch seems that when "lxsession --reload" is called, it calls xevent_init() to set dpy valiable in lxsettings-daemon/xevent.c. However xevent_init() also calls g_source_add_poll(). And once the "lxsesson --reload" process dies, the remaining lxsession process can cause CPU exhanstion when lxsession config file (i.e. desktop.conf) is modified, for example.
I modified the patch a bit, so that when "lxsession --reload" is called, it only sets dpy valiable but not call g_source_add_poll() and so on, then it calls send_internal_command() then exit.