Patch: Window and Dialog fixes
Thomas Fitzsimmons
fitzsim@redhat.com
Fri Sep 19 19:10:00 GMT 2003
On Wed, 2003-09-10 at 13:08, Tom Tromey wrote:
> >>>>> "Tom" == Thomas Fitzsimmons <fitzsim@redhat.com> writes:
>
> More comments...
>
> Tom> + parent = owner;
> Tom> + owner.ownedWindows.add(new WeakReference(this));
>
> Synchronization is needed here, when changing owner.ownedWindows, as
> the other users of ownedWindows also synchronize.
>
> Should we synchronize on the tree lock instead of on the Window?
>
> Tom> + public synchronized Window[] getOwnedWindows()
>
> This method needs to be implemented a different way. The problem is
> that a WeakReference can be cleared between the two loops.
>
> Maybe the only way to do this is to allocate a possibly-too-large
> array, fill it, and then create a new, smaller array if need be.
>
OK, thanks for the comments.
I reworked this patch a little. I realized that null weak references
weren't being removed from ownedWindows. With this iteration of the
patch, I remove them as I discover them.
Accesses to ownedWindows are now synchronized on ownedWindows itself
instead of on the window.
And I fixed the problem Tom noted with getOwnedWindows.
OK to commit?
Thanks,
Tom
2003-09-19 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/Frame.java (dispose): Remove method.
* java/awt/Window.java (ownedWindows): New field.
(Window(Window,GraphicsConfiguration)): Add a weak reference to
owner's ownedWindows vector.
(finalize): Remove method.
(hide): Hide owned windows.
(dispose): Dispose of owned windows.
(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: dialog3.diff
Type: text/x-patch
Size: 18625 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20030919/d1b4d240/attachment.bin>
More information about the Java-patches
mailing list