Closed Bug 596419 Opened 9 years ago Closed 9 years ago

ThebesLayerD3D9 can outlive LayerManager

Categories

(Core :: Graphics, defect)

x86
Windows 7
defect
Not set

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- beta7+

People

(Reporter: bas.schouten, Assigned: bas.schouten)

Details

Attachments

(1 file)

ThebesLayerD3D9 can currently outlive a layer manager, but might still attempt to access it to unregister itself with the device manager. We should handle a LayerManager destruction and clear everything out while the device manager and the layer manager are still around. At the point Destroy is called we are guaranteed that all ThebesLayers created for a certain layer manager are either destroyed or in the layer manager's layer tree.
Attachment #475305 - Flags: review?(jmuizelaar)
Comment on attachment 475305 [details] [diff] [review]
Fix up Layer destruction scheme

># HG changeset patch
># Parent 5f2250cb58c9eb1aa0d3f5515931f640152f2c1d
>
>diff --git a/gfx/layers/d3d9/CanvasLayerD3D9.cpp b/gfx/layers/d3d9/CanvasLayerD3D9.cpp
>--- a/gfx/layers/d3d9/CanvasLayerD3D9.cpp
>+++ b/gfx/layers/d3d9/CanvasLayerD3D9.cpp
>@@ -42,17 +42,17 @@
> #include "gfxWindowsSurface.h"
> #include "gfxWindowsPlatform.h"
> 
> namespace mozilla {
> namespace layers {
> 
> CanvasLayerD3D9::~CanvasLayerD3D9()
> {
>-  if (mD3DManager->deviceManager()) {
>+  if (mD3DManager && mD3DManager->deviceManager()) {
>     mD3DManager->deviceManager()->mLayersWithResources.RemoveElement(this);
>   }
> }

We shouldn't need to check for mD3DManager->deviceManager() (you do this other places too)
Comment on attachment 475305 [details] [diff] [review]
Fix up Layer destruction scheme

>+CanvasLayerD3D9::LayerManagerDestroyed()
>+{
>+  if (mD3DManager->deviceManager()) {

We shouldn't need to check deviceManager() here.
Attachment #475305 - Flags: review?(jmuizelaar) → review+
http://hg.mozilla.org/mozilla-central/rev/4407c9329f8d
Status: ASSIGNED → RESOLVED
blocking2.0: --- → beta7+
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.