[macos] awt_CreateEmbeddedFrame incorrectly caches a local reference

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 8, 11, 14, 15, 16
    • Component/s: client-libs

      The macOS implementation of awt_CreateEmbeddedFrame incorrectly caches a local reference to the embedded frame class, resulting in a crash if invoked a second time.

      JNIEXPORT jobject JNICALL awt_CreateEmbeddedFrame
      (JNIEnv* env, void* platformInfo)
      {
          static jmethodID mid = NULL;
          static jclass cls;
          if (mid == NULL) {
              cls = (*env)->FindClass(env, embeddedClassName);
              CHECK_NULL_RETURN(cls, NULL);
              mid = (*env)->GetMethodID(env, cls, "<init>", "(J)V");
              CHECK_NULL_RETURN(mid, NULL);
          }
          return (*env)->NewObject(env, cls, mid, platformInfo);
      }

            Assignee:
            Unassigned
            Reporter:
            Alan Snyder
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: