[MonoDevelop] Closing dialog windows from my addin freezes MonoDevelop

Scott Ellington scottellington at comcast.net
Wed Oct 5 23:50:34 EDT 2005


Lluis,

I have been doing some research, and I think I have figured out what is
going on.  If MonoDevelop uses the GuiDispatch mechanism to queue calls
to the Gui, then why does it still call Gdk.Threads.Init?  According to
the gdk docs, this method "initializes GDK so that it can be used from
multiple threads in conjunction."  Since MD does not access the Gui from
other threads, calling this method is unnecessary.  

When I comment this method out in MonoDevelopMain.cs, my add-in works as
expected.  Is this the correct solution?

thanks,
Scott 

On Mon, 2005-10-03 at 17:41 +0200, Lluis Sanchez wrote:
> I agree with what Todd said. This call to Threads.Enter should not be
> needed. Try something: call DispatchCommand from a method invoked
> through GLib.Idle, and see if it works in this way.
> 
> El dv 30 de 09 del 2005 a les 14:08 -0400, en/na Scott Ellington va
> escriure: 
> > I figured this out.  It was a threading issue.  I needed to call
> > Gdk.Threads.Enter() and Leave() as so:
> > 
> > Gdk.Threads.Enter();
> > Runtime.Gui.CommandService.CommandManager.DispatchCommand(FileCommands.NewProject);
> > Gdk.Threads.Leave();
> > 
> > Would it be a good idea for DispatchCommand to call these methods?
> > 
> > Scott
> > 
> > On Sun, 2005-09-25 at 21:04 -0400, Scott Ellington wrote:
> > > All,
> > > 
> > > My addin is a welcome page for MonoDevelop.  It uses gecko#, and when a
> > > certain link is clicked, I intercept the OpenUri to spawn a MonoDevelop
> > > Gui command, such as:
> > > 
> > > Runtime.Gui.CommandService.CommandManager.DispatchCommand(FileCommands.NewProject);
> > > 
> > > This opens successfully, but when I try to either close it by clicking
> > > the "New" or "Cancel" buttons, the window does not close and MonoDevelop
> > > freezes.  This also occurs when I use FileCommands.OpenFile.  Strangely,
> > > HelpCommands.TipOfTheDay, closes correctly.  
> > > 
> > > I'm not familiar with writing desktop apps, but I thought it might be a
> > > threading issue.  So I tried wrapping the event handler as suggested in
> > > the following:
> > > http://deobald.glcn.com/wiki/index.php/Thread_management_in_MonoDevelop
> > > without success.  I also checked to see if gecko# was spawning a thread
> > > for the OpenUri event and it seems that my event handler is in the Gui
> > > thread, so I can't see what the problem might be.
> > > 
> > > Finally I tried creating and destroying my own sample Gtk window without
> > > any problem.  Anybody have any ideas, or other things to try next?
> > > 
> > > thanks in advance,
> > > Scott Ellington
> > > 
> > > 
> > > _______________________________________________
> > > Monodevelop-list mailing list
> > > Monodevelop-list at lists.ximian.com
> > > http://lists.ximian.com/mailman/listinfo/monodevelop-list
> 
-- 
Scott Ellington <scottellington at comcast.net>



More information about the Monodevelop-list mailing list