зеркало из https://github.com/mozilla/pjs.git
Bug 595277 - Part 0: Clear out user data on destroy. r=roc
This commit is contained in:
Родитель
5a57702df9
Коммит
e95f123c37
|
@ -190,6 +190,15 @@ public:
|
|||
return mKey == aKey ? mValue.get() : nsnull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear out current user data.
|
||||
*/
|
||||
void Clear()
|
||||
{
|
||||
mKey = nsnull;
|
||||
mValue = nsnull;
|
||||
}
|
||||
|
||||
private:
|
||||
void* mKey;
|
||||
nsAutoPtr<LayerUserData> mValue;
|
||||
|
@ -241,7 +250,7 @@ public:
|
|||
* for its widget going away. After this call, only user data calls
|
||||
* are valid on the layer manager.
|
||||
*/
|
||||
virtual void Destroy() { mDestroyed = PR_TRUE; }
|
||||
virtual void Destroy() { mDestroyed = PR_TRUE; mUserData.Clear(); }
|
||||
PRBool IsDestroyed() { return mDestroyed; }
|
||||
|
||||
/**
|
||||
|
|
|
@ -3196,6 +3196,7 @@ nsWindow::GetLayerManager(bool* aAllowRetaining)
|
|||
if (layerManagerD3D10->device() !=
|
||||
gfxWindowsPlatform::GetPlatform()->GetD3D10Device())
|
||||
{
|
||||
mLayerManager->Destroy();
|
||||
mLayerManager = nsnull;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -608,6 +608,7 @@ PRBool nsWindow::OnPaint(HDC aDC, PRUint32 aNestingLevel)
|
|||
layerManagerD3D9->SetClippingRegion(event.region);
|
||||
result = DispatchWindowEvent(&event, eventStatus);
|
||||
if (layerManagerD3D9->DeviceWasRemoved()) {
|
||||
mLayerManager->Destroy();
|
||||
mLayerManager = nsnull;
|
||||
// When our device was removed, we should have gfxWindowsPlatform
|
||||
// check if its render mode is up to date!
|
||||
|
|
|
@ -154,6 +154,9 @@ PuppetWidget::Destroy()
|
|||
Base::Destroy();
|
||||
mPaintTask.Revoke();
|
||||
mChild = nsnull;
|
||||
if (mLayerManager) {
|
||||
mLayerManager->Destroy();
|
||||
}
|
||||
mLayerManager = nsnull;
|
||||
mTabChild = nsnull;
|
||||
return NS_OK;
|
||||
|
|
|
@ -137,6 +137,10 @@ nsBaseWidget::~nsBaseWidget()
|
|||
static_cast<BasicLayerManager*>(mLayerManager.get())->ClearRetainerWidget();
|
||||
}
|
||||
|
||||
if (mLayerManager) {
|
||||
mLayerManager->Destroy();
|
||||
}
|
||||
|
||||
#ifdef NOISY_WIDGET_LEAKS
|
||||
gNumWidgets--;
|
||||
printf("WIDGETS- = %d\n", gNumWidgets);
|
||||
|
@ -1027,6 +1031,9 @@ nsBaseWidget::SetAcceleratedRendering(PRBool aEnabled)
|
|||
return NS_OK;
|
||||
}
|
||||
mUseAcceleratedRendering = aEnabled;
|
||||
if (mLayerManager) {
|
||||
mLayerManager->Destroy();
|
||||
}
|
||||
mLayerManager = NULL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче