!9287 修复SetWptrNativeWindowToPSurface用例失败问题

Merge pull request !9287 from 刘瓒/producer
This commit is contained in:
openharmony_ci 2024-03-08 01:27:14 +00:00 committed by Gitee
commit 3ff0cb50ba
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -529,9 +529,12 @@ NativeWindow::NativeWindow() : NativeWindowMagic(NATIVE_OBJECT_MAGIC_WINDOW), su
NativeWindow::~NativeWindow()
{
auto utils = SurfaceUtils::GetInstance();
utils->Remove(surface->GetUniqueId());
utils->RemoveNativeWindow(surface->GetUniqueId());
if (surface != nullptr) {
auto utils = SurfaceUtils::GetInstance();
utils->Remove(surface->GetUniqueId());
utils->RemoveNativeWindow(surface->GetUniqueId());
}
for (auto &[seqNum, buffer] : bufferCache_) {
NativeObjectUnreference(buffer);
}