[tasque] [tasque] Partly fix for #557792: Mvmnt of list causes prog freeze



commit 424915bc4d71886504d4ad1c2308df3cc971fc55
Author: Ahmad Sherif <ahmad sherif public gmail com>
Date:   Sun Aug 26 23:11:24 2012 +0200

    [tasque] Partly fix for #557792: Mvmnt of list causes prog freeze
    
    This fixes the issue that the wrong task is marked as completed. See
    bug descr for more details:
    https://bugzilla.gnome.org/show_bug.cgi?id=557792
    
    It doesn't fix the freeze problem, for which a patch has been proposed
    that hasn't been tested yet. The freeze problem is not reproducible on
    Ubuntu 12.04.

 src/TaskTreeView.cs |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/src/TaskTreeView.cs b/src/TaskTreeView.cs
index efeeadc..56bb1ad 100644
--- a/src/TaskTreeView.cs
+++ b/src/TaskTreeView.cs
@@ -21,7 +21,6 @@ namespace Tasque
 		private Gtk.TreeModelFilter modelFilter;
 		private ICategory filterCategory;	
 		private ITask taskBeingEdited = null;
-		private bool toggled;
 
 		private static string status;
 		
@@ -251,8 +250,6 @@ namespace Tasque
 
 		void CellRenderer_EditingStarted (object o, EditingStartedArgs args)
 		{
-			if (!toggled)
-				return;
 
 			Gtk.TreeIter iter;
 			Gtk.TreePath path = new Gtk.TreePath (args.Path);
@@ -264,6 +261,10 @@ namespace Tasque
 				return;
 
 			taskBeingEdited = task;
+
+			if (task.State != TaskState.Inactive)
+				return;
+
 			InactivateTimer.ToggleTimer (taskBeingEdited);
 		}
 		
@@ -273,11 +274,12 @@ namespace Tasque
 			renderer.EditingStarted += CellRenderer_EditingStarted;
 			// Canceled: timer can continue.
 			renderer.EditingCanceled += (o, args) => {
-				if (toggled && taskBeingEdited != null) {
-					taskBeingEdited.Inactivate ();
-					InactivateTimer.ToggleTimer (taskBeingEdited);
+				if (taskBeingEdited != null) {
+					if (taskBeingEdited.State == TaskState.Inactive) {
+						taskBeingEdited.Inactivate ();
+						InactivateTimer.ToggleTimer (taskBeingEdited);
+					}
 					taskBeingEdited = null;
-					toggled = false;
 				}
 			};
 			// Edited: after calling the delegate the timer can continue.
@@ -285,11 +287,12 @@ namespace Tasque
 				if (handler != null)
 					handler (o, args);
 
-				if (toggled && taskBeingEdited != null) {
-					taskBeingEdited.Inactivate ();
-					InactivateTimer.ToggleTimer (taskBeingEdited);
+				if (taskBeingEdited != null) {
+					if (taskBeingEdited.State == TaskState.Inactive) {
+						taskBeingEdited.Inactivate ();
+						InactivateTimer.ToggleTimer (taskBeingEdited);
+					}
 					taskBeingEdited = null;
-					toggled = false;
 				}
 			};
 		}
@@ -642,7 +645,6 @@ namespace Tasque
 					InactivateTimer timer =
 						new InactivateTimer (this, iter, task, (uint) timeout);
 					timer.StartTimer ();
-					toggled = true;
 				}
 			} else {
 				status = Catalog.GetString ("Action Canceled");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]