Main: use AtScopeExit() to free Android objects
This commit is contained in:
parent
49ba76167e
commit
c782fdb698
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user