diff options
author | Thomas Guillem <thomas.guillem@gmail.com> | 2014-09-15 14:03:19 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-09-16 18:25:45 +0200 |
commit | 74fcbb382faebb80ee0b6942ad421b08c603894c (patch) | |
tree | e44235952ad384ef72f3d22770528e0b688081c3 | |
parent | 9836b1dddd72a2da573f3922fd99f3bc7ef5feeb (diff) | |
download | mpd-74fcbb382faebb80ee0b6942ad421b08c603894c.tar.gz mpd-74fcbb382faebb80ee0b6942ad421b08c603894c.tar.xz mpd-74fcbb382faebb80ee0b6942ad421b08c603894c.zip |
android/Bridge: add shutdown()
Break the mainloop and terminate run call.
-rw-r--r-- | android/src/Bridge.java | 1 | ||||
-rw-r--r-- | src/Main.cxx | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/android/src/Bridge.java b/android/src/Bridge.java index dc487fe30..537343b56 100644 --- a/android/src/Bridge.java +++ b/android/src/Bridge.java @@ -26,4 +26,5 @@ import android.content.Context; */ public class Bridge { public static native void run(Context context); + public static native void shutdown(); } diff --git a/src/Main.cxx b/src/Main.cxx index d8384abfb..e41489688 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -696,6 +696,7 @@ int mpd_main(int argc, char *argv[]) #endif delete instance->event_loop; delete instance; + instance = nullptr; #ifndef ANDROID daemonize_finish(); #endif @@ -727,4 +728,12 @@ Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context) Environment::Deinitialise(env); } +gcc_visibility_default +JNIEXPORT void JNICALL +Java_org_musicpd_Bridge_shutdown(JNIEnv *, jclass) +{ + if (instance != nullptr) + instance->event_loop->Break(); +} + #endif |