[Gtk-sharp-list] Gdk.Pixbuf broken on win32? (help!)

Federico Mena Quintero federico@ximian.com
Mon, 06 Dec 2004 20:16:22 -0600


On Mon, 2004-12-06 at 20:20 -0500, Idan Gazit wrote:

> C:\>mono DeChroma.exe test.png
> 
> args 0: test.png
> 
> (DeChroma.exe:3264): GLib-GObject-CRITICAL **: gtype.c:1871: 
> initialization assertion failed, use g_type_init() prior to this function

This happens because the GObject type system has not been initialized by
the time you call new Gdk.Pixbuf.

> using System;
> using Gdk;
> 
> namespace DeChroma
> {
> 	public class TestClass
> 	{		
> 		public static void Main(string[] args) {
> 			System.Console.WriteLine(
> 				"args 0: {0}",
> 				args[0]);
> 			Gdk.Pixbuf foo = new Gdk.Pixbuf(args[0]);
> 		}
> 	}
> }

Calling "Application.Init ()" at the start of your program will fix the
problem.  You'll need "using Gtk" as well.

  Federico