* FYI: backport more async X error fixes from GNU Classpath
@ 2007-04-28 2:05 Thomas Fitzsimmons
0 siblings, 0 replies; only message in thread
From: Thomas Fitzsimmons @ 2007-04-28 2:05 UTC (permalink / raw)
To: java-patches
[-- Attachment #1: Type: text/plain, Size: 658 bytes --]
Hi,
I backported this patch from GNU Classpath to trunk and
redhat/gcc-4_1-branch.
Tom
2007-04-04 Francis Kung <fkung@redhat.com>
* gnu/java/awt/peer/gtk/ComponentGraphics.java
(cairoDrawGlyphVector): Removed method.
(cairoSetFont): Removed method.
(disposeNative): Removed method.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
(Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector): Added
locking.
(Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFont):
Added locking.
(Java_gnu_java_awt_peer_gtk_CairoGraphics2D_disposeNative):
Added locking.
[-- Attachment #2: awt-async-x-error-font-fixes-2.patch --]
[-- Type: text/x-patch, Size: 3570 bytes --]
Index: classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
===================================================================
--- classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c (revision 124226)
+++ classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c (working copy)
@@ -87,7 +87,11 @@
return;
if (gr->cr)
- cairo_destroy (gr->cr);
+ {
+ gdk_threads_enter();
+ cairo_destroy (gr->cr);
+ gdk_threads_leave();
+ }
if (gr->pattern)
cairo_pattern_destroy (gr->pattern);
@@ -343,9 +347,11 @@
(*env)->ReleaseFloatArrayElements (env, java_positions, native_positions, 0);
(*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0);
+ gdk_threads_enter ();
pango_fc_font_lock_face( (PangoFcFont *)pfont->font );
cairo_show_glyphs (gr->cr, glyphs, n);
pango_fc_font_unlock_face( (PangoFcFont *)pfont->font );
+ gdk_threads_leave ();
g_free(glyphs);
}
@@ -367,6 +373,7 @@
pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
g_assert (pfont != NULL);
+ gdk_threads_enter();
face = pango_fc_font_lock_face( (PangoFcFont *)pfont->font );
g_assert (face != NULL);
@@ -380,6 +387,7 @@
cairo_font_face_destroy (ft);
pango_fc_font_unlock_face((PangoFcFont *)pfont->font);
+ gdk_threads_leave();
}
JNIEXPORT void JNICALL
Index: classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java
===================================================================
--- classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java (revision 124226)
+++ classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java (working copy)
@@ -544,6 +544,17 @@
* methods ends up being called, we will deadlock. The lock is only reentrant
* when called via our lock() method.
*/
+
+ /* These methods are already locked in the superclass CairoGraphics2D
+ * so they do not need to be overridden:
+ *
+ * public void disposeNative
+ *
+ * protected void cairoDrawGlyphVector
+ *
+ * protected void cairoSetFont
+ */
+
@Override
protected long init(long pointer)
{
@@ -563,20 +574,6 @@
}
@Override
- public void disposeNative(long pointer)
- {
- try
- {
- lock();
- super.disposeNative(pointer);
- }
- finally
- {
- unlock();
- }
- }
-
- @Override
protected void drawPixels(long pointer, int[] pixels, int w, int h,
int stride, double[] i2u, double alpha,
int interpolation)
@@ -728,36 +725,6 @@
}
@Override
- protected void cairoDrawGlyphVector(long pointer, GdkFontPeer font,
- float x, float y, int n,
- int[] codes, float[] positions)
- {
- try
- {
- lock();
- super.cairoDrawGlyphVector(pointer, font, x, y, n, codes, positions);
- }
- finally
- {
- unlock();
- }
- }
-
- @Override
- protected void cairoSetFont(long pointer, GdkFontPeer font)
- {
- try
- {
- lock();
- super.cairoSetFont(pointer, font);
- }
- finally
- {
- unlock();
- }
- }
-
- @Override
protected void cairoRectangle(long pointer, double x, double y,
double width, double height)
{
Index: classpath/lib/gnu/java/awt/peer/gtk/ComponentGraphics.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-04-28 2:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-28 2:05 FYI: backport more async X error fixes from GNU Classpath Thomas Fitzsimmons
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).