Main: use AtScopeExit() to free Android objects

This commit is contained in:
Max Kellermann 2019-05-29 15:01:23 +02:00
parent 49ba76167e
commit c782fdb698

View File

@ -640,16 +640,16 @@ Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context, jobject _logL
Java::Object::Initialise(env); Java::Object::Initialise(env);
Java::File::Initialise(env); Java::File::Initialise(env);
Environment::Initialise(env); Environment::Initialise(env);
AtScopeExit(env) { Environment::Deinitialise(env); };
context = new Context(env, _context); context = new Context(env, _context);
AtScopeExit() { delete context; };
if (_logListener != nullptr) if (_logListener != nullptr)
logListener = new LogListener(env, _logListener); logListener = new LogListener(env, _logListener);
AtScopeExit() { delete logListener; };
mpd_main(0, nullptr); mpd_main(0, nullptr);
delete logListener;
delete context;
Environment::Deinitialise(env);
} }
gcc_visibility_default gcc_visibility_default