Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@xamarin.com>2015-09-17 16:34:55 +0300
committerLluis Sanchez <lluis@xamarin.com>2015-09-17 16:36:24 +0300
commit774e1076c51ce4de31ccfa63efce01148a9a1969 (patch)
tree37003692470f82adade29aa188fe3d6010533627 /main
parentef4b596fb14d5ef07961605445da796ad1bbc665 (diff)
Fix incorrect UI thread assertion
The synchronization context of a thread may change, so when checking if the context is the UI thread context, check the instance type, not the instance.
Diffstat (limited to 'main')
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs3
1 files changed, 2 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs
index dc5f347be2..ee5ab67e85 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs
@@ -424,7 +424,8 @@ namespace MonoDevelop.Core
/// </summary>
public static void AssertMainThread ()
{
- if (SynchronizationContext.Current != MainSynchronizationContext)
+ // Compare types, because instances can change (using SynchronizationContext.CreateCopy).
+ if (SynchronizationContext.Current.GetType () != MainSynchronizationContext.GetType ())
throw new InvalidOperationException ("Operation not supported in background thread");
}