classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] [Patch] switch GTK peers to extract JNIEnv from JavaVM


From: Michael Koch
Subject: [cp-patches] [Patch] switch GTK peers to extract JNIEnv from JavaVM
Date: Wed, 19 Jan 2005 09:14:45 +0100
User-agent: Mutt/1.5.6+20040907i

Hi list,


I just commited the attached patch to merge it from latest
java-gui-branch.


Michael


Graydon's original explanation for the patch:

this patch, which I've committed to java-gui-branch, "fixes" a problem 
which may or may not be present, depending on the behavior of client 
programs, choice of VM, and choices made in threading elsewhere in the 
AWT implementation: we used to cache a JNIEnv in an extern variable, and 
reuse it in callbacks from GTK.

this patch replaces the extern JNIEnv variable with a JavaVM variable 
and a helper function which fetches the current JNIEnv from the JavaVM. 
this is important only if the callback thread differs from the thread 
which set up the cached value, but it's already caused a couple people 
to trip in the real world, there's little cost to making the change (I 
profiled it; the penalty is 0.001% of runtime), and it makes the GTK 
side more robust against future changes in thread organization.


2005-01-19  Graydon Hoare  <address@hidden>

        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c:
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c:
        Rewrite uses of extern variable to be function calls.
        * native/jni/gtk-peer/gtkpeer.h (gdk_env): Change declaration to
        function, from extern variable.
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
        (gdk_env): Remove variable, add new function.
        (java_vm): Add new variable.
        (Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit): Initialize
        java_vm rather than old gdk_env variable.

Attachment: gtk.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]