[MonoDevelop] One-shot dialogs from add-ins

Casey Marshall casey.s.marshall at gmail.com
Wed Mar 18 16:17:45 EDT 2009


On Mar 18, 2009, at 1:05 PM, Casey Marshall wrote:

> On Mar 18, 2009, at 11:51 AM, Chris Howie wrote:
>
>> On Wed, Mar 18, 2009 at 2:43 PM, Casey Marshall
>> <casey.s.marshall at gmail.com> wrote:
>>> Because, I want to do this:
>>>
>>>  Application.Invoke(delegate {
>>>    run-dialog-and-get-result();
>>>    signal-caller(); // only signal if not originally in GUI thread?
>>>  });
>>>  wait-to-be-signaled(); // only wait if not in GUI thread?
>>>  use-result();
>>
>> If you use e.g. a ManualResetEvent then this will work exactly as you
>> describe.  When you signal the caller (via Set()) this will get
>> stored.  If you are running on the same thread, WaitOne will return
>> immediately since you set it earlier.  If you are on separate threads
>> then the WaitOne will return when Set is called.
>>
>
> OK, this seems to do it:
>
>  string password = null;
>  ManualResetEvent mre = new ManualResetEvent(false);
>  Gtk.Application.Invoke(delegate {
>    password = RunPasswordDialog();
>    mre.Set();
>  });
>  Gtk.Main.Iteration(); // must do this to run the delegate above!
>  mre.WaitOne();
>
> Which was kind of non-obvious, but it works now, and no longer  
> messes up the TreeView.
>

Nope, I still get corruption in the solution tree view:

ERROR [2009-03-18 13:13:19Z]: Gtk-Critical: file /build/buildd/gtk 
+2.0-2.12.9/gtk/gtktreeview.c: line 4895 (gtk_tree_view_bin_expose):  
assertion `has_child' failed.
There is a disparity between the internal view of the GtkTreeView,
and the GtkTreeModel.  This generally means that the model has changed
without letting the view know.  Any display from now on is likely to
be incorrect.

Stack trace:
    at Gtk.Application.Run()
    at MonoDevelop.Ide.Gui.IdeApp.Run()
    at MonoDevelop.Ide.Gui.IdeStartup.Run(System.String[] args)
    at MonoDevelop.Startup.SharpDevelopMain.Main(System.String[] args)


More information about the Monodevelop-list mailing list