mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +09:00
Bug 1467363 - Protect access to mTransparentSurface with a lock.
This commit is contained in:
parent
6d43998298
commit
80e25ee7e5
3 changed files with 14 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ using namespace mozilla::gfx;
|
|||
WinCompositorWidget::WinCompositorWidget(const CompositorWidgetInitData& aInitData)
|
||||
: mWidgetKey(aInitData.widgetKey()),
|
||||
mWnd(reinterpret_cast<HWND>(aInitData.hWnd())),
|
||||
mTransparentSurfaceLock("mTransparentSurfaceLock"),
|
||||
mTransparencyMode(static_cast<nsTransparencyMode>(aInitData.transparencyMode())),
|
||||
mMemoryDC(nullptr),
|
||||
mCompositeDC(nullptr),
|
||||
|
|
@ -39,6 +40,7 @@ WinCompositorWidget::WinCompositorWidget(const CompositorWidgetInitData& aInitDa
|
|||
void
|
||||
WinCompositorWidget::OnDestroyWindow()
|
||||
{
|
||||
MutexAutoLock lock(mTransparentSurfaceLock);
|
||||
mTransparentSurface = nullptr;
|
||||
mMemoryDC = nullptr;
|
||||
}
|
||||
|
|
@ -75,6 +77,8 @@ WinCompositorWidget::GetClientSize()
|
|||
already_AddRefed<gfx::DrawTarget>
|
||||
WinCompositorWidget::StartRemoteDrawing()
|
||||
{
|
||||
MutexAutoLock lock(mTransparentSurfaceLock);
|
||||
|
||||
MOZ_ASSERT(!mCompositeDC);
|
||||
|
||||
RefPtr<gfxASurface> surf;
|
||||
|
|
@ -229,6 +233,7 @@ WinCompositorWidget::LeavePresentLock()
|
|||
RefPtr<gfxASurface>
|
||||
WinCompositorWidget::EnsureTransparentSurface()
|
||||
{
|
||||
mTransparentSurfaceLock.AssertCurrentThreadOwns();
|
||||
MOZ_ASSERT(mTransparencyMode == eTransparencyTransparent);
|
||||
|
||||
IntSize size = GetClientSize().ToUnknownSize();
|
||||
|
|
@ -245,6 +250,7 @@ WinCompositorWidget::EnsureTransparentSurface()
|
|||
void
|
||||
WinCompositorWidget::CreateTransparentSurface(const gfx::IntSize& aSize)
|
||||
{
|
||||
mTransparentSurfaceLock.AssertCurrentThreadOwns();
|
||||
MOZ_ASSERT(!mTransparentSurface && !mMemoryDC);
|
||||
RefPtr<gfxWindowsSurface> surface = new gfxWindowsSurface(aSize, SurfaceFormat::A8R8G8B8_UINT32);
|
||||
mTransparentSurface = surface;
|
||||
|
|
@ -254,6 +260,7 @@ WinCompositorWidget::CreateTransparentSurface(const gfx::IntSize& aSize)
|
|||
void
|
||||
WinCompositorWidget::UpdateTransparency(nsTransparencyMode aMode)
|
||||
{
|
||||
MutexAutoLock lock(mTransparentSurfaceLock);
|
||||
if (mTransparencyMode == aMode) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -270,6 +277,7 @@ WinCompositorWidget::UpdateTransparency(nsTransparencyMode aMode)
|
|||
void
|
||||
WinCompositorWidget::ClearTransparentWindow()
|
||||
{
|
||||
MutexAutoLock lock(mTransparentSurfaceLock);
|
||||
if (!mTransparentSurface) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue