Re: [java-gnome-hackers] handle->GObject mapping needed
Brought to you by:
afcowie
From: Mark H. <mh...@ti...> - 2003-01-09 10:03:43
|
On Sat, 2003-01-04 at 06:37, Tom Ball wrote: > 1. Store an JNI object reference in the native gobject. GTK has the > ability to add named properties using g_object_set, so this is > workable. The AWT uses this method. I guess this would take longer when creating all widgets as more jni calls are required. Would the reference be created using (*env)->NewGlobalRef so that the GC doesn't free it? If so, how will this reference be removed to allow the Java object to be freed? If not, then what will happen if the user does not keep a reference to the Java object > 2. Maintain a hashtable to map handles to GObjects, and use a factory > method instead of constructors to look up or create GObjects from > handles. Constructors would still be used when constructing a new widget. Factory methods would be used when accessing an existing object (or at least existing in the native sense). Why is this a problem? IMHO, it makes more sense than having everything done in constructors. -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... | mh...@ca... |