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 texture is not released issue. #9

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove recursive mutex
To avoid reentrantlock, add a new method without using lock code.
  • Loading branch information
xiaowei-guan committed Dec 14, 2020
commit 40ea715879ef3bebc45e05705f6230cdfaff28f0
11 changes: 7 additions & 4 deletions shell/platform/tizen/external_texture_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,23 @@ bool ExternalTextureGL::PopulateTextureWithIdentifier(
return true;
}

void ExternalTextureGL::DestructionTbmSurface() {
void ExternalTextureGL::DestructionTbmSurfaceWithLock() {
mutex_.lock();
DestructionTbmSurface();
mutex_.unlock();
}

void ExternalTextureGL::DestructionTbmSurface() {
if (!texture_tbm_surface_) {
LoggerE("tbm_surface_h is NULL");
mutex_.unlock();
return;
}
tbm_surface_internal_unref(texture_tbm_surface_);
texture_tbm_surface_ = NULL;
mutex_.unlock();
}

void ExternalTextureGL::destructionCallback(void* user_data) {
ExternalTextureGL* externalTextureGL =
reinterpret_cast<ExternalTextureGL*>(user_data);
externalTextureGL->DestructionTbmSurface();
externalTextureGL->DestructionTbmSurfaceWithLock();
}
3 changes: 2 additions & 1 deletion shell/platform/tizen/external_texture_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ class ExternalTextureGL {
FlutterOpenGLTexture* opengl_texture);
bool OnFrameAvailable(tbm_surface_h tbm_surface);
void DestructionTbmSurface();
void DestructionTbmSurfaceWithLock();

private:
std::unique_ptr<ExternalTextureGLState> state_;
std::recursive_mutex mutex_;
std::mutex mutex_;
tbm_surface_h texture_tbm_surface_;
static void destructionCallback(void* user_data);
const long texture_id_;
Expand Down