[Gtk-sharp-list] Crashes at random spots

James Talton talton at gmail.com
Thu Oct 12 16:47:43 EDT 2006


Thanks Eric for posting about this issue.  It has been hindering me
for some time now.

James



Eric Albright wrote:

I received one reply off list that solved my problem. So I'll summarize it here.

It turns out that even when you label your main function with
[STAThread] on a dual-core machine, we get problems with weird
crashes.
The solution is to use the following thread idiom:

 Glib.Thread.Init();
 Gdk.Threads.Init();
 Application.Init();

 Gdk.Threads.Enter();
 try
 {
   Application.Run();
 }
 finally
 {
   Gdk.Threads.Leave();
 }


More information about the Gtk-sharp-list mailing list