Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix StrictMode: java.lang.Throwable: Explicit termination method 'rel… #32

Closed
wants to merge 1 commit into from

Conversation

TanZhiL
Copy link

@TanZhiL TanZhiL commented Jan 17, 2022

…ease' not called

@domchen
Copy link
Collaborator

domchen commented Jan 17, 2022

Java的Surface生命周期不归 PAGSurface 管理,是外部持有的,应该由外部负责销毁。这里不能统一加释放接口,会对上层的业务造成影响。另外 上层 PAGView是有执行 Java Surface的延迟销毁的,参考 MSG_SURFACE_DESTROY 这个消息响应的地方。目的是兼容 Android 低版本的系统 API bug导致的crash,具体参考: https://www.jianshu.com/p/675455c225bd

@domchen domchen closed this Jan 17, 2022
@domchen
Copy link
Collaborator

domchen commented Jan 17, 2022

还是感谢给我们发 PR~

@TanZhiL
Copy link
Author

TanZhiL commented Jan 18, 2022

Java的Surface生命周期不归 PAGSurface 管理,是外部持有的,应该由外部负责销毁。这里不能统一加释放接口,会对上层的业务造成影响。另外 上层 PAGView是有执行 Java Surface的延迟销毁的,参考 MSG_SURFACE_DESTROY 这个消息响应的地方。目的是兼容 Android 低版本的系统 API bug导致的crash,具体参考: https://www.jianshu.com/p/675455c225bd

public static PAGSurface FromSurfaceTexture(SurfaceTexture surfaceTexture, EGLContext shareContext) {
    return surfaceTexture == null ? null : FromSurface(new Surface(surfaceTexture), shareContext);
}

这里的surface对象是直接被new出来的,外部目前无法拿到这个引用操作

MSG_SURFACE_DESTROY 这个消息只执行了surfaceTexture.release(); 没有执行surface.release(),所以会被StrictMode检测到

@domchen
Copy link
Collaborator

domchen commented Jan 18, 2022

好的,那要判断一下是否是自己new的Surface才能release()。你这个StrictMode检测有相关的资料么?如何开启或复写?我们可以测试一下。再次感谢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants