gEDA-dev: Another autosave crash....

Patrick Bernaud b-patrick at wanadoo.fr
Sun Sep 3 09:52:24 EDT 2006


Hi Ales and all,

Ales Hvezda writes:
 > [snip]
 > >I can confirm that CVS version of gschem tends to crash if you leave it
 > >running idle for a couple of hours (I often leave my workstation in the
 > >middle of my work and when I come back I usually find gschem crashed).
 > 
 > 	:-(
 > 
 > 	There is a race between the deletion of a page (or other
 > user activites) and the auto save mechanism.  I am in the process of
 > adding a mutex to protect/fix this problem.

I may be wrong but I do not think a mutex will help in any way.

The autosave is implemented with a GSource, an event source that is
managed by the GLib main loop. The program enters the main loop when
it is idle. Every source is checked and any in the ready state get its
callback to be run.

Therefore there is no thread involved and no race condition possible
since there is only one function that get access to the data at any
time.


I can not reproduce this bug here but I think I have something: it
appears the timeout source is not removed when the toplevel it is
attached to is deleted. This way it is possible for the program to
enter the s_page_autosave() function while its toplevel parameter
points on something that is no more a valid TOPLEVEL.

Could people would have experienced this bug please try adding the
following lines to s_toplevel_delete(), recompile and let us know if
it solved the issue or not?

  if (toplevel->auto_save_timeout != 0) {
    gboolean ret;
    ret = g_source_remove (toplevel->auto_save_timeout);
    g_assert (ret);
  }


Regards,


Patrick


More information about the geda-dev mailing list