Patch: Window and Dialog fixes

Thomas Fitzsimmons fitzsim@redhat.com
Tue Sep 9 00:34:00 GMT 2003


On Fri, 2003-09-05 at 17:45, Tom Tromey wrote:
> >>>>> "Tom" == Thomas Fitzsimmons <fitzsim@redhat.com> writes:
> 
> >> I think Window.hide() will fail during the window between when the
> >> `weakThis' is cleared and when the actual window is finalized -- this
> >> isn't an atomic operation.  In this situation, I'd expect a
> >> NullPointerException.  
> 
> Tom> Hmm, I don't understand.  By cleared you mean removed from the
> Tom> ownedWindows vector?
> 
> Nope, I meant when the WeakReference is cleared.
> In the loops, when you use Reference.get(), you have to make sure
> that the result isn't null.
> 

Right, duh.  Thanks for spelling it out.

> Tom> I think I must have been using the wrong compiler or something when I
> Tom> saw this.  When the jboolean argument was true in the java code, it was
> Tom> being passed to the JNI code with a value of 112.
> 
> Did you see this in the debugger, or some other way?  I've noticed
> sometimes gdb will get confused about jboolean.

No, I was seeing GLIB runtime assertion failure messages about gbooleans
being out of range.  Printfs showed that a jboolean with value 112 was
being passed directly to a GLIB function.  If I see it again, I'll take
closer note.

Anyway, attached is a revised patch based on Tom's comments.

Tom

2003-09-08  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/java/awt/peer/gtk/GtkDialogPeer.java (create()): Create a
	top-level GTK window.
	(getArgs): Add "title" property.
	* gnu/java/awt/peer/gtk/GtkWindowPeer.java (setResizable): Use
	"allow_shrink" and "allow_grow" properties.
	* java/awt/Dialog.java: Initialize resizable to true and change
	comments accordingly.  Initialize visible to false in
	constructors.
	* java/awt/Window.java (ownedWindows): New field.
	(Window(Window,GraphicsConfiguration)): Add a weak reference to
	owner's ownedWindows vector.
	(finalize): Remove method.
	(hide): Make synchronized.  Hide owned windows as well as this.
	(dispose): Make synchronized.  Dispose of owned windows as well
	as this.
	(getOwnedWindows): Implement.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c: Remove
	unused GtkArg code.
	(set(String,boolean)): Clamp gboolean parameter to g_object_set
	to TRUE or FALSE.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
	(create): Set window's size requisition.
	(connectHooks): Fix indentation.
	(setResizable): Remove function.
	(static setBounds): Likewise.
	(setBounds): Replace call to setBounds with GTK size requisition
	and resize calls.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dialog2.diff
Type: text/x-patch
Size: 17556 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20030909/92dca32d/attachment.bin>


More information about the Java-patches mailing list