Hi Carlos,

[snip]
>autosave backups newer then the schematic itself. I have some issues I
>want to get comments about....
>The main one is what should applications other than gschem do when they
>found an autosave backup. For example: what happens if an autosave
>backup is found when running gattrib, gnetlist, or whatever? should the
>user be warned and asked for an action? should they just exit (telling
>the user what's happening, of course) and let the user run gschem to
>correct the situation?

        As a bare minimum a warning should be outputed.  I'm okay with that
for the all the programs.  

>
>Currently, autosave is done in gschem, and when opening an schematic,
>there is a call to f_open, which is in libgeda.
>
>I'm considering two ways of implementing the warning:
>  - First one: look for autosave backups in f_open, in libgeda. If
>backups are found, then call an application function, which should be
>coded in gschem, gattrib, gnetlist or whatever (like libgeda's
>arc_draw_func(), for example). This will allow each app to handle this
>situation independently, with or without GUI. I'm not sure about what to
>do in the other apps. I think the user shouldn't be allowed to run any
>other app in an schematic older than its autosave backup (this situation
>should be corrected before the user goes further in the process flow). 
>  - Another option would be to replace all the f_open calls in gschem by
>a call to another function, which looks for the autosave backup and ask
>the user if necessary. This way all the other apps won't change, but the
>user will only notice that there's an autosave backup when running
>gschem.
>
>What do you think?
>

        I like option #1 since it allows the behavior to be modified on 
a per app basis.  However, I'm okay with just printing out a warning in 
the first revision of this mechanism.


>P.S.: Ales, could you tell more about the bug you found in the last
>FreeDog meeting?


        I had the following assertion fire during the meeting:

  g_assert(toplevel->page_head != NULL && toplevel->page_head->pid == -1);

in s_page_autosave.  I also saw some random crashes here and there.
I'm not 100% sure that my code changes are completely correct, but the
autosave mechanism has at least one problem.  I think the autosave
mechanism should be changed so that it doesn't autosave inside the timer
callback, since _none_ of the libgeda/gschem code is multithread safe.
You can still use a timer callback which sets a flag and then this flag is
tested and acted upon in o_undo_savestate().  I picked o_undo_savestate()
since that is where you are pretty much guaranteed to have the program
(and all the data structures) in a known good state.  gschem and friends
have been historically single thread and I really would not introduce
multi-threading issues at this point in time.

Let me know if you need me to clarify this further. Thanks,

                                                        -Ales

Reply via email to