[Mono-list] Gdk.Keyval.Name - problem (and running GNOME-apps problem as well)

Fredrick Nilsson bender@impala.mine.nu
Thu, 01 Jan 2004 18:24:13 +0100


I'm trying to retrieve the name for a key that is pressed. I'm using a
method that looks something like this (a rough example):

	void ButtonsPressed (object o, GtkSharp.KeyPressEventArgs args) 
		Gdk.EventKey key = args.Event;
		string keyname = "bah";
		keyname = Gdk.Keyval.Name ((uint) key.keyval); 
		Console.WriteLine ("keyname: " + keyname);

Unfortunately, it fails with the following error message:

Unhandled Exception: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.NullReferenceException: A null value was found where an object
instance was required
in (unmanaged) (wrapper managed-to-native) GLibSharp.Marshaller:g_free
in <0x00004> (wrapper managed-to-native) GLibSharp.Marshaller:g_free
in <0x00025> GLibSharp.Marshaller:PtrToStringGFree (intptr)
in <0x0002a> Gdk.Keyval:Name (uint)
in <0x00047> .MainWindow:ButtonsPressed
in (unmanaged) /usr/lib/libmono.so.0 [0x40054ae1]
in (unmanaged) /usr/lib/libmono.so.0(mono_runtime_invoke+0x35)
in (unmanaged) /usr/lib/libmono.so.0(mono_runtime_invoke_array+0x21b)
in (unmanaged) /usr/lib/libmono.so.0 [0x400ae2c1]
in <0x0009c> System.Reflection.MonoMethod:Invoke
--- End of inner exception stack trace ---
in <0x000e4> System.Reflection.MonoMethod:Invoke
in <0x00026> System.Reflection.MethodBase:Invoke (object,object[])
in <0x00105> System.Delegate:DynamicInvokeImpl (object[])
in <0x00048> System.MulticastDelegate:DynamicInvokeImpl (object[])
in <0x00011> System.Delegate:DynamicInvoke (object[])
in <0x001e0>
in <0x00166> (wrapper native-to-managed)
in (unmanaged) (wrapper managed-to-native) Gtk.Application:gtk_main ()
in <0x00004> (wrapper managed-to-native) Gtk.Application:gtk_main ()
in <0x00007> Gtk.Application:Run ()
in <0x00007> Gnome.Program:Run ()
in <0x000b7> .Hello:Main (string[])

And I just can't see the error I'm making here. 

The other problem I have, Is that when I'm making a GNOME application, I
always get these warnings:

(Command Key Edit:19114): GConf-CRITICAL **: file gconf-client.c: line
546 (gconf_client_add_dir): assertion `gconf_valid_key (dirname, NULL)'
** (Command Key Edit:19114): WARNING **: byref boolean marshalling not
** (Command Key Edit:19114): WARNING **: byref boolean marshalling not

This even happens when I implement a simple Hello World-application (for
http://go-mono.com/tutorial/gnome/bindings/gnome/hello_world.html). If I
implement a GNOME application that uses Gnome.Program.Quit, It crashes
and i receive the error: ** ERROR **: Must shutdown ORB from main thread

Anyone that has some input on the problems i experience?