[java-gnome-hackers] Widget ref and unref
Brought to you by:
afcowie
From: Mark H. <mh...@ti...> - 2002-08-27 11:46:06
|
hi, If a widget is removed from a container, it is destroyed unless there has been a call to gtk_widget_ref(handle). To get the widget to be destroyed, a call must be made to gtk_widget_unref(handle); IMHO, this should not happen in Java - once you construct an object, it should exist until the java reference to it is lost.=20 Therefore, I have added this code to the Widget class. The ref is made in the initializeEventHanders method (All widgets should call this in their constructors); and the unref is done in a finalize method, so it will be done when java start garbage collecting the object. I have not found any problems with this in the small amount of testing I have done.=20 Let me know if there are any objection to this change. --=20 +----------------------------------------------+ | Mark Howard cam.ac.uk mh344@ | | http://www.tildemh.com tildemh.com mh@ | +----------------------------------------------+ |