Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

8252057: Crash in metal pipeline when dragging any Swing app to other…

  • Loading branch information
Alexey Ushakov committed Aug 20, 2020
1 parent a9e6747 commit f85fcbbe8ae35c96dcb256f43e242ed09365c31b
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.m
@@ -835,6 +835,9 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
jlong pDst = NEXT_LONG(b);

dstOps = (BMTLSDOps *)jlong_to_ptr(pDst);
if (mtlc != NULL) {
[mtlc.encoderManager endEncoder];
}
mtlc = [MTLContext setSurfacesEnv:env src:pSrc dst:pDst];
break;
}
@@ -852,6 +855,9 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
if (newMtlc == NULL) {

} else {
if (mtlc != NULL) {
[mtlc.encoderManager endEncoder];
}
mtlc = newMtlc;
dstOps = NULL;
}
@@ -893,6 +899,9 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
// the previous method will call glX/wglMakeCurrent(None),
// so we should nullify the current mtlc and dstOps to avoid
// calling glFlush() (or similar) while no context is current
if (mtlc != NULL) {
[mtlc.encoderManager endEncoder];
}
mtlc = NULL;
// dstOps = NULL;
break;
@@ -902,6 +911,9 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
CHECK_PREVIOUS_OP(MTL_OP_OTHER);
// invalidate the references to the current context and
// destination surface that are maintained at the native level
if (mtlc != NULL) {
[mtlc.encoderManager endEncoder];
}
mtlc = NULL;
// dstOps = NULL;
break;

0 comments on commit f85fcbb

Please sign in to comment.