[Xfce4-commits] <xfce4-notes-plugin:master> Fix race condition that needlessly showed the refresh-button

Mike Massonnet noreply at xfce.org
Sun Feb 20 22:28:01 CET 2011


Updating branch refs/heads/master
         to 1a4781fe45a8c6c3ae9fe84f048ed42670e9ff5c (commit)
       from f0d385b1651885383a7d819e500946812e9101b7 (commit)

commit 1a4781fe45a8c6c3ae9fe84f048ed42670e9ff5c
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Sun Feb 20 21:17:13 2011 +0100

    Fix race condition that needlessly showed the refresh-button
    
    The monitoring support is meant to be something simple and not overcomplicated,
    therefore there is a single point-of-entry that marks a window as being edited
    from an external tool. While a window contains several notes, saving more than
    one of them shifted by 1 second results in false positive. The simple fix to
    avoid this race condition is currently to increase the window-updated timeout.
    
    Also in this commit, when the user decides to not reload the notes from the
    disk, save the current notes right back to the disk.

 lib/application.vala    |    7 +++++--
 lib/window-monitor.vala |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/application.vala b/lib/application.vala
index c45ab31..3872a6a 100644
--- a/lib/application.vala
+++ b/lib/application.vala
@@ -536,9 +536,12 @@ namespace Xnp {
 				var win = create_window (name);
 				win.show ();
 			}
+			else {
+				set_data_value (window, "external-change", false);
+				window.show_refresh_button = false;
+				window.save_notes ();
 
-			set_data_value (window, "external-change", false);
-			window.show_refresh_button = false;
+			}
 		}
 
 		/*
diff --git a/lib/window-monitor.vala b/lib/window-monitor.vala
index d790e8a..b5a3dfa 100644
--- a/lib/window-monitor.vala
+++ b/lib/window-monitor.vala
@@ -66,7 +66,7 @@ namespace Xnp {
 			if (monitor_timeout != 0) {
 				Source.remove (monitor_timeout);
 			}
-			monitor_timeout = Timeout.add_seconds (1, () => {
+			monitor_timeout = Timeout.add_seconds (5, () => {
 				window_updated (window);
 				monitor_timeout = 0;
 				return false;



More information about the Xfce4-commits mailing list