Commit 74fcbb38 authored by Thomas Guillem's avatar Thomas Guillem Committed by Max Kellermann

android/Bridge: add shutdown()

Break the mainloop and terminate run call.
parent 9836b1dd
...@@ -26,4 +26,5 @@ import android.content.Context; ...@@ -26,4 +26,5 @@ import android.content.Context;
*/ */
public class Bridge { public class Bridge {
public static native void run(Context context); public static native void run(Context context);
public static native void shutdown();
} }
...@@ -696,6 +696,7 @@ int mpd_main(int argc, char *argv[]) ...@@ -696,6 +696,7 @@ int mpd_main(int argc, char *argv[])
#endif #endif
delete instance->event_loop; delete instance->event_loop;
delete instance; delete instance;
instance = nullptr;
#ifndef ANDROID #ifndef ANDROID
daemonize_finish(); daemonize_finish();
#endif #endif
...@@ -727,4 +728,12 @@ Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context) ...@@ -727,4 +728,12 @@ Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context)
Environment::Deinitialise(env); Environment::Deinitialise(env);
} }
gcc_visibility_default
JNIEXPORT void JNICALL
Java_org_musicpd_Bridge_shutdown(JNIEnv *, jclass)
{
if (instance != nullptr)
instance->event_loop->Break();
}
#endif #endif
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