OSDN Git Service

Fix locking a destroyed mutex.
authorNicolas Capens <capn@google.com>
Fri, 19 May 2017 14:57:28 +0000 (10:57 -0400)
committerNicolas Capens <capn@google.com>
Fri, 19 May 2017 21:00:56 +0000 (21:00 +0000)
commitbf7a8145635e7dc6625596be127733ac7418cf21
tree33ff5610c0389540591f44cfe77a35a989d781ca
parentf6a377b0e6e4bbfcc958abd2fc1bc0aacc9bbef3
Fix locking a destroyed mutex.

Surface should not lock the resource of a parent texture at destruction, because
it can already have been destroyed. For example when a texture's image was bound
as a render target, and the texture is deleted by the app, then the image holds
the last reference to the texture. When the render target image gets deleted, it
first releases its parent texture, and then the underlying surface gets
destroyed.

This is fixed by synchronizing, by locking and unlocking the (parent) resource,
earlier. The derived class is responsible for calling Surface::sync() before
releasing the parent resource.

Bug chromium:716803

Change-Id: Ifc3685dcf9e25e8419000af65d4bb7407f26bbcb
Reviewed-on: https://swiftshader-review.googlesource.com/9750
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
14 files changed:
src/Common/Resource.hpp
src/D3D8/Direct3DCubeTexture8.cpp
src/D3D8/Direct3DTexture8.cpp
src/D3D8/Direct3DVolumeTexture8.cpp
src/D3D9/Direct3DCubeTexture9.cpp
src/D3D9/Direct3DTexture9.cpp
src/D3D9/Direct3DVolumeTexture9.cpp
src/OpenGL/common/Image.cpp
src/OpenGL/common/Image.hpp
src/OpenGL/libGL/Texture.cpp
src/OpenGL/libGLES_CM/Texture.cpp
src/OpenGL/libGLESv2/Texture.cpp
src/Renderer/Surface.cpp
src/Renderer/Surface.hpp