[MonoDevelop] Closing dialog windows from my addin freezes MonoDevelop

Scott Ellington scottellington at comcast.net
Mon Oct 3 11:35:18 EDT 2005


I tried something to the effect of this:

void MyUriHandler ( object sender, OpenUriArgs e )
{
	GLib.Idle.Add ( new GLib.IdleHandler (DispatchToUi) )
}

bool DispatchToUi()
{
	Runtime.Gui.CommandService.CommandManager.DispatchCommand
				(FileCommands.NewProject);
	return false;
}

The app still hangs on closing the dialog.  Let me know if this is not
what you meant me to do. 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