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

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2004-12-02 19:06:37 +0300
committerjfrijters <jfrijters>2004-12-02 19:06:37 +0300
commit8508aceed4d552cd72868da435edcb0abe0a7962 (patch)
treeb473b662d8629fd333e7732f7c4e234e5579187b
parent0a991fe02042585c0d0964851251600493013f59 (diff)
*** empty log message ***
-rw-r--r--awt/toolkit.cs30
1 files changed, 16 insertions, 14 deletions
diff --git a/awt/toolkit.cs b/awt/toolkit.cs
index c50c699d..cbde4973 100644
--- a/awt/toolkit.cs
+++ b/awt/toolkit.cs
@@ -57,7 +57,7 @@ namespace ikvm.awt
public class NetToolkit : gnu.java.awt.ClasspathToolkit
{
private static java.awt.EventQueue eventQueue = new java.awt.EventQueue();
- private static Form bogusForm;
+ private static volatile Form bogusForm;
private static Delegate createControlInstance;
private int resolution;
@@ -66,18 +66,20 @@ namespace ikvm.awt
private static void MessageLoop()
{
createControlInstance = new CreateControlInstanceDelegate(CreateControlImpl);
- Form form = new Form();
- form.CreateControl();
- // HACK I have no idea why this line is necessary...
- IntPtr p = form.Handle;
- bogusForm = form;
- // HACK to make sure we can be aborted (Thread.Abort) we need to periodically
- // fire an event (because otherwise we'll be blocking in unmanaged code and
- // the Abort cannot be handled there).
- System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
- t.Interval = 100;
- t.Start();
- Application.Run();
+ using(Form form = new Form())
+ {
+ form.CreateControl();
+ // HACK I have no idea why this line is necessary...
+ IntPtr p = form.Handle;
+ bogusForm = form;
+ // HACK to make sure we can be aborted (Thread.Abort) we need to periodically
+ // fire an event (because otherwise we'll be blocking in unmanaged code and
+ // the Abort cannot be handled there).
+ System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
+ t.Interval = 100;
+ t.Start();
+ Application.Run();
+ }
}
internal static Control CreateControlImpl(Type type)
@@ -103,7 +105,7 @@ namespace ikvm.awt
Thread thread = new Thread(new ThreadStart(MessageLoop));
thread.Start();
// TODO don't use polling...
- while(bogusForm == null)
+ while(bogusForm == null && thread.IsAlive)
{
Thread.Sleep(1);
}