Commit 371455b9 authored by Nikolay Igotti's avatar Nikolay Igotti

Search objc pool functions more agressively

parent b9911735
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
#import <jawt.h> #import <jawt.h>
#import <jawt_md.h> #import <jawt_md.h>
#include <dlfcn.h>
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>
#import <Metal/Metal.h> #import <Metal/Metal.h>
...@@ -110,18 +113,26 @@ JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_makeMeta ...@@ -110,18 +113,26 @@ JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_makeMeta
return (jlong) renderTarget; return (jlong) renderTarget;
} }
extern "C" void* objc_autoreleasePoolPush(void); typedef void* (*objc_autoreleasePoolPush_t)(void);
extern "C" void objc_autoreleasePoolPop(void*); typedef void (*objc_autoreleasePoolPop_t)(void*);
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_startRendering( JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_startRendering(
JNIEnv * env, jobject redrawer) JNIEnv * env, jobject redrawer)
{ {
static objc_autoreleasePoolPush_t objc_autoreleasePoolPush = NULL;
if (objc_autoreleasePoolPush == NULL) {
objc_autoreleasePoolPush = (objc_autoreleasePoolPush_t)dlsym(RTLD_DEFAULT, "objc_autoreleasePoolPush");
}
return (jlong)objc_autoreleasePoolPush(); return (jlong)objc_autoreleasePoolPush();
} }
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_endRendering( JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_endRendering(
JNIEnv * env, jobject redrawer, jlong handle) JNIEnv * env, jobject redrawer, jlong handle)
{ {
static objc_autoreleasePoolPop_t objc_autoreleasePoolPop = NULL;
if (objc_autoreleasePoolPop == NULL) {
objc_autoreleasePoolPop = (objc_autoreleasePoolPop_t)dlsym(RTLD_DEFAULT, "objc_autoreleasePoolPop");
}
objc_autoreleasePoolPop((void*)handle); objc_autoreleasePoolPop((void*)handle);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment