Crash in the FontManager code due to use of JNIEnv saved by another thread

XMLWordPrintable

    • 2d
    • b54
    • generic
    • generic
    • Not verified

        JNI code in the font manager caches JNIEnv and it may be saved by one thread and reused
        by another. This may cause crash.

        The 'font2D' jobject needs to be converted into a global reference because its lifetime exceeds the lifetime of a native method call.

        This is applicable at least to Freetype glue code.

        Here is sample stacktrace from the crash:

        Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
        V [libjvm.so+0x298366]
        C [libfontmanager.so+0x59e4]
        C [libfreetype.so.6+0x73c9] FT_Stream_Close+0x19
        C [libfreetype.so.6+0xa065] FT_Stream_Free+0x25
        C [libfreetype.so.6+0xa6e2]
        C [libfreetype.so.6+0xaf78] FT_Done_Face+0x78
        C [libfontmanager.so+0x6964]
        Java_sun_font_FreetypeFontScaler_disposeNativeScaler+0x34

              Assignee:
              Igor Nekrestyanov (Inactive)
              Reporter:
              Igor Nekrestyanov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: