[Geany-devel] SM r4968 bug - and more
earshinov at xxxxx
Fri Jun 4 07:48:22 UTC 2010
On Thu, 3 Jun 2010 19:14:39 +0300%
Dimitar Zhekov <dimitar.zhekov at gmail.com> wrote:
> On Wed, 2 Jun 2010 22:17:02 +0400
> Eugene Arshinov <earshinov at gmail.com> wrote:
> > On Wed, 2 Jun 2010 20:33:37 +0300%
> > Dimitar Zhekov <dimitar.zhekov at gmail.com> wrote:
> > > The "startup time" between which two events? The SM does not know
> > > when a program is started, and does not care when/if it's first
> > > window will be displayed. You can even write a console program
> > > with SM support. :)
> > Between, for example, establishing the connection and the time when
> > we can handle the first message from session manager (i.e., the time
> > message loop starts working). Again, it's just a wild guess.
> I read the above and was enlightened. The first message a SM sends to
> a newly registered application, when adding it to a session, is a
> With the sm_set_runtime_props() call in sm_save_yourself_callback()
> commented out, 4968 does not kill the session on startup.
Interesting. It's worth debugging sm_set_runtime_props() with gdb
step-by-step and see when session is killed.
> While reading sm.c, however, I noticed what looks like two more bugs.
> if (cl_options.load_session)
> /* Files will be restored by Geany session management
> facilities. */
> store_project = store_files = FALSE;
> If I'm not mistaken, this code leaves the file/project list
> save/restore to Geany, for a main instance only. But what if you have
> 2+ main instances? They will all try to save their file list or active
> project in geany.conf; even with race .lock protection, only one will
> succeed; and on session restore, there will be 2+ identical instances.
> The fix is pretty easy, just remove the above check. Any per-file
> settings for project-less instances will be lost, but they are lost
> for the secondary project-less instances anyway...
Well, in addition to removing the check I will have to forbid reading
file list from config when an instance is started by session manager.
Not too hard, though.
To speak truth, when I wrote this code I didn't think about several
main instances. I still does not understand why they are needed.
Lex explained me why opening one project in several instances can be
useful, but opening several main instances seems to be even more crazy
> if (project_prefs.project_session)
> /* Files will be restored when the project is
> reopened. */
> store_files = FALSE;
> This assumes that the value of project_prefs.project_session is
> identical at the time when Geany is stopped and then restarted. But
> with your sm, on restart, all geany-s read their options from the
> single geany.conf. What if I have 3 instances running, choose Edit ->
> Preferences in one of them, and (un)check "Project based session
> files"? The other 2 instances will not be aware of the change when
> being stopped, and will get the new value when restarted.
Good catch. Seems that always storing files in command-line and not
loading them from project file on restore would fix this "boundary
More information about the Devel