mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 18:27:35 +00:00
Fix one-time leak of nsGCCache. r=pavlov@netscape.com sr=waterson@netscape.com b=60215
This commit is contained in:
parent
994a352f4c
commit
66680e0a0e
@ -180,5 +180,11 @@ static nsModuleComponentInfo components[] =
|
||||
nsScreenManagerGtkConstructor }
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE("nsGfxGTKModule", components)
|
||||
PR_STATIC_CALLBACK(void)
|
||||
nsGfxGTKModuleDtor(nsIModule *self)
|
||||
{
|
||||
nsRenderingContextGTK::Shutdown();
|
||||
}
|
||||
|
||||
NS_IMPL_NSGETMODULE_WITH_DTOR("nsGfxGTKModule", components, nsGfxGTKModuleDtor)
|
||||
|
||||
|
@ -45,7 +45,7 @@ static NS_DEFINE_CID(kRegionCID, NS_REGION_CID);
|
||||
gdk.height = ns.height; \
|
||||
PR_END_MACRO
|
||||
|
||||
static nsGCCache *gcCache = new nsGCCache();
|
||||
static nsGCCache *gcCache = nsnull;
|
||||
|
||||
nsRenderingContextGTK::nsRenderingContextGTK()
|
||||
{
|
||||
@ -102,6 +102,12 @@ nsRenderingContextGTK::~nsRenderingContextGTK()
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ nsresult
|
||||
nsRenderingContextGTK::Shutdown()
|
||||
{
|
||||
delete gcCache;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRenderingContextGTK::Init(nsIDeviceContext* aContext,
|
||||
nsIWidget *aWindow)
|
||||
@ -519,6 +525,10 @@ void nsRenderingContextGTK::UpdateGC()
|
||||
mClipRegion->GetNativeRegion((void*&)rgn);
|
||||
}
|
||||
|
||||
if (!gcCache) {
|
||||
gcCache = new nsGCCache();
|
||||
if (!gcCache) return;
|
||||
}
|
||||
mGC = gcCache->GetGC(mSurface->GetDrawable(),
|
||||
&values,
|
||||
valuesMask,
|
||||
|
@ -51,6 +51,7 @@ class nsRenderingContextGTK : public nsRenderingContextImpl
|
||||
public:
|
||||
nsRenderingContextGTK();
|
||||
virtual ~nsRenderingContextGTK();
|
||||
static nsresult Shutdown(); // release statics
|
||||
|
||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user