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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Potapov <dpotapov@gmail.com>2014-02-02 23:55:12 +0400
committerDmitry Potapov <dpotapov@gmail.com>2014-02-02 23:55:12 +0400
commit0a339c31a3315f21477c7c5dba71b6818590c02c (patch)
tree14d584d674813ebff420e459a0a965a8504c88d9 /mcs/class/WindowsBase
parent38a1e8d3bd687088c2c804c47e082aaafe9e0f34 (diff)
Dispatcher.PushFrame: clean references before return
The dispatcher did not clean references before returning, therefore the second call to Dispatcher.Run() failed.
Diffstat (limited to 'mcs/class/WindowsBase')
-rw-r--r--mcs/class/WindowsBase/System.Windows.Threading/Dispatcher.cs4
-rw-r--r--mcs/class/WindowsBase/Test/System.Windows.Threading/DispatcherTest.cs12
2 files changed, 16 insertions, 0 deletions
diff --git a/mcs/class/WindowsBase/System.Windows.Threading/Dispatcher.cs b/mcs/class/WindowsBase/System.Windows.Threading/Dispatcher.cs
index 031f8081e87..f9c11ccc8fe 100644
--- a/mcs/class/WindowsBase/System.Windows.Threading/Dispatcher.cs
+++ b/mcs/class/WindowsBase/System.Windows.Threading/Dispatcher.cs
@@ -358,6 +358,10 @@ namespace System.Windows.Threading {
frame.dispatcher = dis;
dis.RunFrame (frame);
+
+ frame.dispatcher = null;
+ dis.current_frame = frame.ParentFrame;
+ frame.ParentFrame = null;
}
void PerformShutdown ()
diff --git a/mcs/class/WindowsBase/Test/System.Windows.Threading/DispatcherTest.cs b/mcs/class/WindowsBase/Test/System.Windows.Threading/DispatcherTest.cs
index 614cef51a43..0980ebb12ba 100644
--- a/mcs/class/WindowsBase/Test/System.Windows.Threading/DispatcherTest.cs
+++ b/mcs/class/WindowsBase/Test/System.Windows.Threading/DispatcherTest.cs
@@ -149,6 +149,18 @@ namespace MonoTests.System.Windows.Threading
Dispatcher.PushFrame(frame);
}
+
+ [Test]
+ public void TestRunTwice()
+ {
+ Dispatcher d = Dispatcher.CurrentDispatcher;
+ Action exit = delegate { Dispatcher.ExitAllFrames(); };
+
+ d.BeginInvoke(DispatcherPriority.Normal, exit);
+ Dispatcher.Run();
+ d.BeginInvoke(DispatcherPriority.Normal, exit);
+ Dispatcher.Run();
+ }
}
}