Bug 824868. Make AutoLayerManagerSetup save the layer manager it is using so we are sure to use the right oen when it goes out of scope to clean up. r=roc

This commit is contained in:
Timothy Nikkel 2012-12-26 23:55:41 -06:00
parent 3728dd7ebc
commit 3930f84ffc
2 changed files with 10 additions and 12 deletions

View File

@ -736,25 +736,22 @@ nsBaseWidget::AutoLayerManagerSetup::AutoLayerManagerSetup(
BufferMode aDoubleBuffering, ScreenRotation aRotation)
: mWidget(aWidget)
{
BasicLayerManager* manager =
static_cast<BasicLayerManager*>(mWidget->GetLayerManager());
if (manager) {
NS_ASSERTION(manager->GetBackendType() == LAYERS_BASIC,
mLayerManager = static_cast<BasicLayerManager*>(mWidget->GetLayerManager());
if (mLayerManager) {
NS_ASSERTION(mLayerManager->GetBackendType() == LAYERS_BASIC,
"AutoLayerManagerSetup instantiated for non-basic layer backend!");
manager->SetDefaultTarget(aTarget);
manager->SetDefaultTargetConfiguration(aDoubleBuffering, aRotation);
mLayerManager->SetDefaultTarget(aTarget);
mLayerManager->SetDefaultTargetConfiguration(aDoubleBuffering, aRotation);
}
}
nsBaseWidget::AutoLayerManagerSetup::~AutoLayerManagerSetup()
{
BasicLayerManager* manager =
static_cast<BasicLayerManager*>(mWidget->GetLayerManager());
if (manager) {
NS_ASSERTION(manager->GetBackendType() == LAYERS_BASIC,
if (mLayerManager) {
NS_ASSERTION(mLayerManager->GetBackendType() == LAYERS_BASIC,
"AutoLayerManagerSetup instantiated for non-basic layer backend!");
manager->SetDefaultTarget(nullptr);
manager->SetDefaultTargetConfiguration(mozilla::layers::BUFFER_NONE, ROTATION_0);
mLayerManager->SetDefaultTarget(nullptr);
mLayerManager->SetDefaultTargetConfiguration(mozilla::layers::BUFFER_NONE, ROTATION_0);
}
}

View File

@ -217,6 +217,7 @@ public:
~AutoLayerManagerSetup();
private:
nsBaseWidget* mWidget;
nsRefPtr<BasicLayerManager> mLayerManager;
};
friend class AutoLayerManagerSetup;