|
|
@ -5,11 +5,14 @@ |
|
|
|
// <version>$Revision$</version>
|
|
|
|
// <version>$Revision$</version>
|
|
|
|
// </file>
|
|
|
|
// </file>
|
|
|
|
|
|
|
|
|
|
|
|
using ICSharpCode.SharpDevelop.Util; |
|
|
|
|
|
|
|
using System; |
|
|
|
using System; |
|
|
|
|
|
|
|
using System.Runtime.InteropServices; |
|
|
|
using System.Threading; |
|
|
|
using System.Threading; |
|
|
|
|
|
|
|
|
|
|
|
using ICSharpCode.Core.WinForms; |
|
|
|
using ICSharpCode.Core.WinForms; |
|
|
|
using ICSharpCode.SharpDevelop.Gui; |
|
|
|
using ICSharpCode.SharpDevelop.Gui; |
|
|
|
|
|
|
|
using ICSharpCode.SharpDevelop.Util; |
|
|
|
|
|
|
|
using Microsoft.Win32.SafeHandles; |
|
|
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.SharpDevelop.DefaultEditor |
|
|
|
namespace ICSharpCode.SharpDevelop.DefaultEditor |
|
|
|
{ |
|
|
|
{ |
|
|
@ -65,9 +68,16 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor |
|
|
|
} |
|
|
|
} |
|
|
|
currentWorker = workerThread.Enqueue(DoUpdate); |
|
|
|
currentWorker = workerThread.Enqueue(DoUpdate); |
|
|
|
// wait a few ms in case the clipboard can be accessed without problems
|
|
|
|
// wait a few ms in case the clipboard can be accessed without problems
|
|
|
|
currentWorker.AsyncWaitHandle.WaitOne(50); |
|
|
|
WaitForSingleObject(currentWorker.AsyncWaitHandle.SafeWaitHandle, 50); |
|
|
|
|
|
|
|
// Using WaitHandle.WaitOne() pumps some Win32 messages.
|
|
|
|
|
|
|
|
// To avoid unintended reentrancy, we need to avoid pumping messages,
|
|
|
|
|
|
|
|
// so we directly call the Win32 WaitForSingleObject function.
|
|
|
|
|
|
|
|
// See SD2-1638 for details.
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("kernel32", SetLastError=true, ExactSpelling=true)] |
|
|
|
|
|
|
|
static extern Int32 WaitForSingleObject(SafeWaitHandle handle, Int32 milliseconds); |
|
|
|
|
|
|
|
|
|
|
|
static void DoUpdate() |
|
|
|
static void DoUpdate() |
|
|
|
{ |
|
|
|
{ |
|
|
|
clipboardContainsText = ClipboardWrapper.ContainsText; |
|
|
|
clipboardContainsText = ClipboardWrapper.ContainsText; |
|
|
|