зеркало из https://github.com/mozilla/gecko-dev.git
Bug 593530 - Don't leak the DeviceManagerD3D9 if initializing it fails. r=joe a=blocking2.0:beta6+
This commit is contained in:
Родитель
b63cc0ba47
Коммит
881a4c21e1
|
@ -189,6 +189,9 @@ DeviceManagerD3D9::~DeviceManagerD3D9()
|
|||
LayerManagerD3D9::OnDeviceManagerDestroy(this);
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(DeviceManagerD3D9)
|
||||
NS_IMPL_RELEASE(DeviceManagerD3D9)
|
||||
|
||||
bool
|
||||
DeviceManagerD3D9::Init()
|
||||
{
|
||||
|
|
|
@ -106,9 +106,13 @@ class THEBES_API DeviceManagerD3D9
|
|||
{
|
||||
public:
|
||||
DeviceManagerD3D9();
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
protected:
|
||||
nsAutoRefCnt mRefCnt;
|
||||
NS_DECL_OWNINGTHREAD
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(DeviceManagerD3D9)
|
||||
|
||||
public:
|
||||
bool Init();
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,8 +65,8 @@ LayerManagerD3D9::~LayerManagerD3D9()
|
|||
*/
|
||||
mSwapChain = nsnull;
|
||||
|
||||
if (mDeviceManager) {
|
||||
mDeviceManager->Release();
|
||||
if (mDeviceManager && mDeviceManager->Release() == 0) {
|
||||
mDeviceManager = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,15 +79,17 @@ LayerManagerD3D9::Initialize()
|
|||
|
||||
if (!mDeviceManager) {
|
||||
mDeviceManager = new DeviceManagerD3D9;
|
||||
mDeviceManager->AddRef();
|
||||
|
||||
if (!mDeviceManager->Init()) {
|
||||
mDeviceManager->Release();
|
||||
mDeviceManager = nsnull;
|
||||
return PR_FALSE;
|
||||
}
|
||||
} else {
|
||||
mDeviceManager->AddRef();
|
||||
}
|
||||
|
||||
mDeviceManager->AddRef();
|
||||
|
||||
mSwapChain = mDeviceManager->
|
||||
CreateSwapChain((HWND)mWidget->GetNativeData(NS_NATIVE_WINDOW));
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче