1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Use static initialization for Android class loader

This commit is contained in:
ζeh Matt
2023-06-27 23:09:53 +03:00
parent 60a2d5c1f6
commit 484523f82f
3 changed files with 1 additions and 16 deletions

View File

@@ -27,7 +27,7 @@ AndroidClassLoader::~AndroidClassLoader()
jobject AndroidClassLoader::_classLoader;
jmethodID AndroidClassLoader::_findClassMethod;
static std::shared_ptr<AndroidClassLoader> acl;
static std::shared_ptr<AndroidClassLoader> acl = std::make_shared<AndroidClassLoader>();
namespace Platform
{
@@ -173,11 +173,6 @@ namespace Platform
return displayScale;
}
void AndroidInitClassLoader()
{
acl = std::make_shared<AndroidClassLoader>();
}
jclass AndroidFindClass(JNIEnv* env, std::string_view name)
{
return static_cast<jclass>(env->CallObjectMethod(

View File

@@ -39,15 +39,6 @@ namespace Platform
{
void CoreInit()
{
static bool initialised = false;
if (!initialised)
{
initialised = true;
#ifdef __ANDROID__
Platform::AndroidInitClassLoader();
#endif // __ANDROID__
}
}
CurrencyType GetCurrencyValue(const char* currCode)

View File

@@ -103,7 +103,6 @@ namespace Platform
bool SetupUriProtocol();
#endif
#ifdef __ANDROID__
void AndroidInitClassLoader();
jclass AndroidFindClass(JNIEnv* env, std::string_view name);
#endif