| Summary: | Leak in Android_JNI_SetActivityTitle (SDL_SetWindowTitle) | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Martin Gerhardy <martin.gerhardy> |
| Component: | *don't know* | Assignee: | Gabriel Jacobo <gabomdq> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | gabomdq |
| Version: | HG 2.0 | ||
| Hardware: | ARM | ||
| OS: | Android (All) | ||
| Attachments: | bug fix | ||
Created attachment 854 [details]
bug fix
I'm attaching your bug fix in patch form so Sam or Ryan can incorporate it more easily. Thanks!
Fixed in changeset 6048116f40b1 |
Calling SDL_SetWindowTitle in a loop will result in a jvm crash because the jstring for the title is not marked as garbage collactable. this fixed the issue: extern "C" void Android_JNI_SetActivityTitle(const char *title) { jmethodID mid; mid = mEnv->GetStaticMethodID(mActivityClass,"setActivityTitle","(Ljava/lang/String;)V"); if (mid) { jstring jtitle = reinterpret_cast<jstring>(mEnv->NewStringUTF(title)); mEnv->CallStaticVoidMethod(mActivityClass, mid, jtitle); mEnv->DeleteLocalRef(jtitle); } } how to reproduce: just do a loop with n = 513 and call SDL_SetWindowTitle with different title strings.