mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-6522 macOS: SIGSEGV at [libawt_lwawt.dylib+0x8eaa8] MTLGC_DestroyMTLGraphicsConfig
Fix of MT access to shared data in MTLGraphicsConfigInfo
(cherry picked from commit ecc46c6004)
This commit is contained in:
@@ -37,21 +37,24 @@ void
|
||||
MTLGC_DestroyMTLGraphicsConfig(jlong pConfigInfo)
|
||||
{
|
||||
J2dTraceLn(J2D_TRACE_INFO, "MTLGC_DestroyMTLGraphicsConfig");
|
||||
JNI_COCOA_ENTER(env);
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^() {
|
||||
MTLGraphicsConfigInfo *mtlinfo =
|
||||
(MTLGraphicsConfigInfo *)jlong_to_ptr(pConfigInfo);
|
||||
if (mtlinfo == NULL) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
||||
"MTLGC_DestroyMTLGraphicsConfig: info is null");
|
||||
return;
|
||||
}
|
||||
|
||||
MTLGraphicsConfigInfo *mtlinfo =
|
||||
(MTLGraphicsConfigInfo *)jlong_to_ptr(pConfigInfo);
|
||||
if (mtlinfo == NULL) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
||||
"MTLGC_DestroyMTLGraphicsConfig: info is null");
|
||||
return;
|
||||
}
|
||||
|
||||
MTLContext *mtlc = (MTLContext*)mtlinfo->context;
|
||||
if (mtlc != NULL) {
|
||||
[mtlinfo->context release];
|
||||
mtlinfo->context = nil;
|
||||
}
|
||||
free(mtlinfo);
|
||||
MTLContext *mtlc = (MTLContext*)mtlinfo->context;
|
||||
if (mtlc != NULL) {
|
||||
[mtlinfo->context release];
|
||||
mtlinfo->context = nil;
|
||||
}
|
||||
free(mtlinfo);
|
||||
}];
|
||||
JNI_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +70,6 @@ JNIEXPORT jlong JNICALL
|
||||
Java_sun_java2d_metal_MTLGraphicsConfig_getMTLConfigInfo
|
||||
(JNIEnv *env, jclass mtlgc, jint displayID, jstring mtlShadersLib)
|
||||
{
|
||||
__block MTLContext* mtlc = nil;
|
||||
__block MTLGraphicsConfigInfo* mtlinfo = nil;
|
||||
|
||||
JNI_COCOA_ENTER(env);
|
||||
@@ -76,7 +78,7 @@ JNI_COCOA_ENTER(env);
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:YES block:^() {
|
||||
|
||||
mtlc = [[MTLContext alloc] initWithDevice:displayID
|
||||
MTLContext* mtlc = [[MTLContext alloc] initWithDevice:displayID
|
||||
shadersLib:path];
|
||||
if (mtlc != 0L) {
|
||||
// create the MTLGraphicsConfigInfo record for this context
|
||||
|
||||
Reference in New Issue
Block a user