瀏覽代碼

Fixes #2847. CursesDriver doesn't processing response from task threading.

BDisp 1 年之前
父節點
當前提交
a45d65bbdd
共有 2 個文件被更改,包括 3 次插入4 次删除
  1. 2 3
      Terminal.Gui/ConsoleDrivers/CursesDriver/UnixMainLoop.cs
  2. 1 1
      UICatalog/Scenarios/Threading.cs

+ 2 - 3
Terminal.Gui/ConsoleDrivers/CursesDriver/UnixMainLoop.cs

@@ -82,7 +82,6 @@ namespace Terminal.Gui {
 		bool poll_dirty = true;
 		int [] wakeupPipes = new int [2];
 		static IntPtr ignore = Marshal.AllocHGlobal (1);
-		static IntPtr readHandle = Marshal.AllocHGlobal (1);
 		MainLoop mainLoop;
 		bool winChanged;
 
@@ -97,8 +96,8 @@ namespace Terminal.Gui {
 		{
 			this.mainLoop = mainLoop;
 			pipe (wakeupPipes);
-			AddWatch (wakeupPipes [1], Condition.PollIn, ml => {
-				read (wakeupPipes [1], ignore, readHandle);
+			AddWatch (wakeupPipes [0], Condition.PollIn, ml => {
+				read (wakeupPipes [0], ignore, (IntPtr)1);
 				return true;
 			});
 		}

+ 1 - 1
UICatalog/Scenarios/Threading.cs

@@ -157,7 +157,7 @@ namespace UICatalog.Scenarios {
 					LogJob ($"Returned from task Thread:{Thread.CurrentThread.ManagedThreadId} {DateTime.Now}");
 					_itemsList.SetSource (items);
 					LogJob ($"Finished populate list view Thread:{Thread.CurrentThread.ManagedThreadId} {DateTime.Now}");
-					_btnActionCancel.Text = "Load Items";
+					_btnActionCancel.Text = "Cancelable Load Items";
 				} else {
 					LogJob ("Task was canceled!");
 				}