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

Idan Gazit idan@fastmail.fm
Mon, 06 Dec 2004 20:20:45 -0500


Hey all,

So I am trying my hand at c#/gtk# for the first time, please forgive if 
this is too obvious; however I haven't found anything about this in the 
docs:

Basically, I can't create a Gdk.Pixbuf from a file. The constructor, 
Pixbuf(string filename), obviously triggers a call to the GTK+ C 
library, and then I get:

---- console ----

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

(DeChroma.exe:3264): GLib-GObject-CRITICAL **: file gobject.c: line 615 
(g_object_new): assertion `G_TYPE_IS_OBJECT (object_type)' failed

Unhandled Exception: System.NullReferenceException: Object reference not 
set to an instance of an object
in (unmanaged) (wrapper managed-to-native) 
Gdk.Pixbuf:gdk_pixbuf_new_from_file (string,intptr&)
in <0x00004> (wrapper managed-to-native) 
Gdk.Pixbuf:gdk_pixbuf_new_from_file (string,intptr&)
in <0x00060> Gdk.Pixbuf:.ctor (string)
in <0x00059> DeChroma.TestClass:Main (string[])

---- console ----


The code which causes this is the following:

---- code ----

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]);
		}
	}
}

---- code ----


I *know* that the file exists, as I get a file not found error if I feed 
it a bogus filename. I know that the file is valid, and have tried it on 
two different file types thus far (jpeg and png). Both yield the same 
result and render fine in every graphics app I throw them at.

Is this a bug in gtk#? If it isn't, could some kind soul please post the 
line or two of code example which shows what to do?

Thanks!

Idan
idan AT fastmail DOT fm