Comments (10)
As an example, the following code can cause the same issue.
FileHandle testFile = Gdx.files.internal("test.mp3");
Music testMusic = Gdx.audio.newMusic(testFile);
testMusic.setOnCompletionListener(music -> {
testMusic.dispose();
});
testMusic.play();
from libgdx-oboe.
I will try to look into it, thanks for reporting !
from libgdx-oboe.
Thanks!
After further testing, I've noticed that this is not related to play().
The following code can reproduce the problem without calling play().
FileHandle testFile = Gdx.files.internal("test.mp3");
Music testMusic = Gdx.audio.newMusic(testFile);
testMusic.setOnCompletionListener(music -> {
});
testMusic.dispose();
In OboeMusic.setCompletionCallback(), old callback is disposed using context->DeleteGlobalRef(old_callback).
In OboeMusic.dispose(), callback is disposed using delete get_var_as(env, self, "onComplete").
Maybe this is causing the issue?
oboemusic.cpp:
OBOEMUSIC_METHOD(void, setCompletionCallback) (JNIEnv* env, jobject self, jobject callback) {
auto context = jni_context::acquire_thread();
auto old_callback = get_var_as<_jobject>(env, self, "onComplete");
if (old_callback != NULL) {
context->DeleteGlobalRef(old_callback) ;
}
auto new_callback = context->NewGlobalRef(callback);
set_var_as(env, self, "onComplete", new_callback);
auto instance = shared_ptr_var<music>(env, self, "music");
instance->on_complete([new_callback] {
auto context = jni_context::acquire_thread();
auto callback_class = jvm_class(context->GetObjectClass(new_callback));
callback_class.execute_method<void()>(new_callback, "invoke");
});
}
OBOEMUSIC_METHOD(void, dispose) (JNIEnv* env, jobject self) {
delete get_var_as<std::shared_ptr<music>>(env, self, "music");
delete get_var_as<jobject>(env, self, "onComplete");
}
from libgdx-oboe.
Alright, fixed !
Will be in the next release 0.2.4 once I'm done with #2.
Feel free to reopen if you'll experience crashes with dispose()
again.
from libgdx-oboe.
That's great news! Thanks a ton!
from libgdx-oboe.
Is there any estimate on the release date? Would it be possible for you to kindly release a version with this fix in or post a copy of the so file for armeabi-v7a?
from libgdx-oboe.
Estimate is this weekend (most probably this sunday). Copy of the so file won't work since there are changes on the kotlin side as well.
If you need it asap, you can clone the repository and put a temporary local dependency in your project instead of the bintray one. You'll need to install NDK though.
from libgdx-oboe.
Sunday is great. Thanks!
from libgdx-oboe.
Thank you for creating this library! This library is great!
It crashes on sum devices, mostly on arm64 system.
Below is the crash log:
[split_config.arm64_v8a.apk!liblibgdx-oboe.so] Java_barsoosayque_libgdxoboe_OboeAudio_pause
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0 >>> com.myapp.test <<<
backtrace:
#00 pc 0x000000000005e8b4 /data/app/~~j7tklfpkB_MLQi1RF5VeUA==/com.myapp.test-yLtgSK985RacB_pwElM2nA==/split_config.arm64_v8a.apk!liblibgdx-oboe.so (Java_barsoosayque_libgdxoboe_OboeAudio_pause)
#01 pc 0x00000000001f315c /data/app/~~j7tklfpkB_MLQi1RF5VeUA==/com.myapp.test-yLtgSK985RacB_pwElM2nA==/oat/arm64/base.odex (art_jni_trampoline)
#02 pc 0x0000000000319a10 /data/app/~~j7tklfpkB_MLQi1RF5VeUA==/com.myapp.test-yLtgSK985RacB_pwElM2nA==/oat/arm64/base.odex (com.badlogic.gdx.backends.android.AndroidApplication$1.pause)
#03 pc 0x000000000038f990 /data/app/~~j7tklfpkB_MLQi1RF5VeUA==/com.myapp.test-yLtgSK985RacB_pwElM2nA==/oat/arm64/base.odex (com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame)
#04 pc 0x0000000000275f68 /data/app/~~j7tklfpkB_MLQi1RF5VeUA==/com.myapp.test-yLtgSK985RacB_pwElM2nA==/oat/arm64/base.odex (com.badlogic.gdx.backends.android.AndroidGraphics$1.run)
#05 pc 0x000000000063be60 /system/framework/arm64/boot-framework.oat (android.opengl.GLSurfaceView$GLThread.guardedRun)
#06 pc 0x000000000063ccf4 /system/framework/arm64/boot-framework.oat (android.opengl.GLSurfaceView$GLThread.run)
#07 pc 0x0000000000133564 /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub)
#08 pc 0x00000000001a97e8 /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*))
#09 pc 0x000000000055de54 /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*))
#10 pc 0x00000000005adcd4 /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*))
#11 pc 0x00000000000b0838 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*))
#12 pc 0x00000000000505d0 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread)
from libgdx-oboe.
@Tonielro it appears to be not related to dispose()
? If that's the case, can you open a new issue with the same description as your comment, but also can you provide a repro ? I always struggle to reproduce crashes, especially if the crash is bound to hardware.
from libgdx-oboe.
Related Issues (17)
- Modular OboeAudio
- bintray libgdx-oboe not build success. HOT 2
- OboeAudio doesn't play music/sounds during entire first foreground session. HOT 2
- Crashes at activity onResume. HOT 2
- Crash when starting app on some devices HOT 3
- Crashes on Google pre-paunch report HOT 7
- How to add libgdx-oboe to my libgdx project? HOT 5
- Failed to load natives on older Android versions HOT 6
- General volume is lower than on the default libGDX implementation. HOT 4
- Bundle natives in AAR HOT 6
- Implement Audio Recorder
- Reduce binary size HOT 1
- Crackling popping HOT 10
- Cannot locate symbol "av_malloc_array" referenced by "libswresample.so" HOT 9
- Play of sound always return 0. HOT 6
- JNI DETECTED ERROR IN APPLICATION: use of deleted global reference HOT 21
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libgdx-oboe.