[Mono-list] assertion g_utf8_validate failed

Jonathan Pryor jonpryor@vt.edu
Fri, 12 Nov 2004 06:51:16 -0500


On Fri, 2004-11-12 at 00:50 -0300, Mario Fuentes wrote:
> All machines are GNU/Linux (Debian).  I'm confused about how to use
> Gdk.Threads.[Enter|Leave](), occasionally the GUI is freezed.

Don't use Gdk.Threads.Enter and Gdk.Threads.Leave, *ever*, unless you
(1) *really* know what you're doing, and (2) *REALLY* know what you're
doing.  GTK+ isn't thread safe -- most toolkits aren't -- and trying to
manipulate widgets from a different thread is tricky, at best.

Instead, use GLib.Timeout.Add (with a small timeout) or
Gtk.ThreadNotify.  You can pass each of these a delegate, which will be
invoked from the GTK+ UI thread, so you don't need to worry about
locking/unlocking the application, cleaning up your code, and
maintaining your sanity.

 - Jon