fix a memory leak.

This commit is contained in:
pavlov%pavlov.net 1999-03-21 21:50:59 +00:00
parent 1d2ade1398
commit eb63856c74
2 changed files with 5 additions and 3 deletions

View File

@ -58,10 +58,9 @@ nsDrawingSurfaceGTK :: nsDrawingSurfaceGTK()
nsDrawingSurfaceGTK :: ~nsDrawingSurfaceGTK()
{
#ifdef NS_GTK_REF
if (mPixmap)
::gdk_pixmap_unref(mPixmap);
#endif
if (mImage)
::gdk_image_destroy(mImage);
}
@ -219,7 +218,6 @@ NS_IMETHODIMP nsDrawingSurfaceGTK :: Init(GdkGC *aGC, PRUint32 aWidth,
mIsOffscreen = PR_TRUE;
mPixmap = ::gdk_pixmap_new(nsnull, mWidth, mHeight, mDepth);
g_print("pixmap is not going to be freed\n");
return NS_OK;
}

View File

@ -138,7 +138,11 @@ NS_IMETHODIMP nsRenderingContextGTK::Init(nsIDeviceContext* aContext,
if (mSurface)
{
#ifndef NS_GTK_REF
GdkDrawable *win = (GdkDrawable*)gdk_window_ref((GdkWindow *)aWindow->GetNativeData(NS_NATIVE_WINDOW));
#else
GdkDrawable *win = (GdkDrawable *)aWindow->GetNativeData(NS_NATIVE_WINDOW);
#endif
GdkGC *gc = (GdkGC *)aWindow->GetNativeData(NS_NATIVE_GRAPHIC);
mSurface->Init(win,gc);