[Geany-devel] SM r4968 bug - and more

Dimitar Zhekov dimitar.zhekov at xxxxx
Thu Jun 3 16:14:39 UTC 2010


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
"SaveYourself(SaveLocal)".

With the sm_set_runtime_props() call in sm_save_yourself_callback()
commented out, 4968 does not kill the session on startup.


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...


		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.

-- 
E-gards: Jimmy



More information about the Devel mailing list