On Wed, 2011-09-07 at 10:56 -0700, Colin D Bennett wrote: > On Wed, 07 Sep 2011 12:54:27 +0100 I've fixed it now by copying the gedit solution of checking file mtimes on mouse in to the main window. (Should cover most use-cases of the user switching between applications editing the same file). I did track down the root of my problems with the GIO stuff. Turns out to be a race / bug in GLib's inotify driver. Nothing we can fix that soon. > How about this for a solution: > > 1. When saving to disk, don't disconnect/reconnect the file watch, > just leave it connected. However, ignore any file modification > events until the save is completed. > Set a flag: ignore_changes := True Would have worked, apart from the File->Save As case. I'd have had to disconnect and re-connect the watch to point at the new file, BEFORE we save into it to be sure not to get (or miss) change notifications (depending on the GLib bug). Ok - we _could_ have made that work, but the error handling cases are nasty, as it would mean the core telling the GUI that its file-name has changed before we even tried to save into it. Currently, we only update the current board's filename if the SaveAs operation succeeds - which is nice. (I'm also thinking that we should be future-proof for any notional "File->Save a copy" operations which don't update the new board location. > 2. Immediately after the save is completed, read the modification > time on the file from disk. Store this time: > save_time := file.mtime > > 3. Set ignore_changes := False to resume processing file > modification events. The modification event handler should, > however, ignore any modification event if the file modification > time is equal to the previously captured save_time. I've done it purely on mtimes, and it "seems" to work. No doubt someone will find me a corner case where it is broken though :( Best wishes, -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me)
Attachment:
signature.asc
Description: This is a digitally signed message part
_______________________________________________ geda-user mailing list geda-user@xxxxxxxxxxxxxx http://www.seul.org/cgi-bin/mailman/listinfo/geda-user