| Summary: | SDL_RWFromFile check for existance leads to crash | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Martin Gerhardy <martin.gerhardy> |
| Component: | file | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | gabomdq |
| Version: | HG 2.0 | ||
| Hardware: | ARM | ||
| OS: | Android (All) | ||
|
Description
Martin Gerhardy
2013-04-19 04:02:06 UTC
If I change #if defined(ANDROID) #ifdef HAVE_STDIO_H in SDL_RWFromFile to #if defined(ANDROID) #if 0 it works. SDL_AndroidGetInternalStoragePath
mid = env->GetMethodID(env->GetObjectClass(fileObject),
"getAbsolutePath", "()Ljava/lang/String;");
this line leads to
W/dalvikvm(27162): Exception thrown (Ljava/lang/NoSuchMethodError;) while throwing internal exception (Ljava/lang/NoSuchMethodError;)
E/dalvikvm(27162): JNI ERROR (app bug): attempt to use stale global reference 0x1a
E/dalvikvm(27162): VM aborting
Does this happen on a newish Android? (4.x) I've seen something quite like this happen with the audio buffers, which were allocated on the Java side and passed to the C side. Something changed in Android 4.x that made this sort of code where an object is returned fail (in this case I think fileObject is the problem). The workaround I used was allocating the audio buffer on the C side directly, but it seems in this case a proper fix will be needed. I could not reproduce this on Android 4.2. I tried opening a non existent file, existing files, etc, SDL_AndroidGetInternalStoragePath runs once and returns /data/data/<package>/files, after that it just returns the interally stored static string. Can you provide more information about your system? Android version, device, are you using threads, etc? I will check on the weekend - thanks a lot for also looking into it. I will try to provide some more information. Btw. I also had SDL_AndroidGetActivity problem with the references - maybe this was related somehow? Any luck? I'm not able to reproduce this anymore - but I've updated my system and the ndk. I'm also building for a new android target. So it might already be fixed or might be some old android-** target problem. For me it works now and is no longer a problem. Okay, thanks for the update. Please feel free to reopen this bug if you find that it's not fixed. |