зеркало из https://github.com/mozilla/gecko-dev.git
fixed duplicate resource free.
This commit is contained in:
Родитель
6458aae507
Коммит
b90db6870e
|
@ -32,6 +32,20 @@
|
||||||
#include "ddraw.h"
|
#include "ddraw.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//#define GFX_DEBUG
|
||||||
|
|
||||||
|
#ifdef GFX_DEBUG
|
||||||
|
#define BREAK_TO_DEBUGGER DebugBreak()
|
||||||
|
#else
|
||||||
|
#define BREAK_TO_DEBUGGER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GFX_DEBUG
|
||||||
|
#define VERIFY(exp) ((exp) ? 0: (GetLastError(), BREAK_TO_DEBUGGER))
|
||||||
|
#else // !_DEBUG
|
||||||
|
#define VERIFY(exp) (exp)
|
||||||
|
#endif // !_DEBUG
|
||||||
|
|
||||||
static NS_DEFINE_IID(kIDOMRenderingContextIID, NS_IDOMRENDERINGCONTEXT_IID);
|
static NS_DEFINE_IID(kIDOMRenderingContextIID, NS_IDOMRENDERINGCONTEXT_IID);
|
||||||
static NS_DEFINE_IID(kIRenderingContextIID, NS_IRENDERING_CONTEXT_IID);
|
static NS_DEFINE_IID(kIRenderingContextIID, NS_IRENDERING_CONTEXT_IID);
|
||||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||||
|
@ -152,36 +166,18 @@ GraphicsState :: ~GraphicsState()
|
||||||
{
|
{
|
||||||
if (NULL != mClipRegion)
|
if (NULL != mClipRegion)
|
||||||
{
|
{
|
||||||
::DeleteObject(mClipRegion);
|
VERIFY(::DeleteObject(mClipRegion));
|
||||||
mClipRegion = NULL;
|
mClipRegion = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != mSolidBrush)
|
//these are killed by the rendering context...
|
||||||
{
|
|
||||||
::DeleteObject(mSolidBrush);
|
|
||||||
mSolidBrush = NULL;
|
mSolidBrush = NULL;
|
||||||
}
|
mSolidPen = NULL;
|
||||||
|
mDashedPen = NULL;
|
||||||
|
mDottedPen = NULL;
|
||||||
|
|
||||||
//don't delete this because it lives in the font metrics
|
//don't delete this because it lives in the font metrics
|
||||||
mFont = NULL;
|
mFont = NULL;
|
||||||
|
|
||||||
if (NULL != mSolidPen)
|
|
||||||
{
|
|
||||||
::DeleteObject(mSolidPen);
|
|
||||||
mSolidPen = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL != mDashedPen)
|
|
||||||
{
|
|
||||||
::DeleteObject(mDashedPen);
|
|
||||||
mDashedPen = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL != mDottedPen)
|
|
||||||
{
|
|
||||||
::DeleteObject(mDottedPen);
|
|
||||||
mDottedPen = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDrawingSurfaceWin :: nsDrawingSurfaceWin()
|
nsDrawingSurfaceWin :: nsDrawingSurfaceWin()
|
||||||
|
@ -206,7 +202,7 @@ nsDrawingSurfaceWin :: ~nsDrawingSurfaceWin()
|
||||||
HBITMAP bits = (HBITMAP)::SelectObject(mDC, mOrigBitmap);
|
HBITMAP bits = (HBITMAP)::SelectObject(mDC, mOrigBitmap);
|
||||||
|
|
||||||
if (nsnull != bits)
|
if (nsnull != bits)
|
||||||
::DeleteObject(bits);
|
VERIFY(::DeleteObject(bits));
|
||||||
|
|
||||||
mOrigBitmap = nsnull;
|
mOrigBitmap = nsnull;
|
||||||
}
|
}
|
||||||
|
@ -362,6 +358,7 @@ nsRenderingContextWin :: nsRenderingContextWin()
|
||||||
mCurrBrushColor = NULL;
|
mCurrBrushColor = NULL;
|
||||||
mCurrFontMetrics = nsnull;
|
mCurrFontMetrics = nsnull;
|
||||||
mCurrPenColor = NULL;
|
mCurrPenColor = NULL;
|
||||||
|
mCurrPen = NULL;
|
||||||
mNullPen = NULL;
|
mNullPen = NULL;
|
||||||
mCurrTextColor = RGB(0, 0, 0);
|
mCurrTextColor = RGB(0, 0, 0);
|
||||||
mCurrLineStyle = nsLineStyle_kSolid;
|
mCurrLineStyle = nsLineStyle_kSolid;
|
||||||
|
@ -378,7 +375,6 @@ nsRenderingContextWin :: nsRenderingContextWin()
|
||||||
PushState();
|
PushState();
|
||||||
|
|
||||||
mP2T = 1.0f;
|
mP2T = 1.0f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRenderingContextWin :: ~nsRenderingContextWin()
|
nsRenderingContextWin :: ~nsRenderingContextWin()
|
||||||
|
@ -411,7 +407,7 @@ nsRenderingContextWin :: ~nsRenderingContextWin()
|
||||||
|
|
||||||
if (NULL != mDefFont)
|
if (NULL != mDefFont)
|
||||||
{
|
{
|
||||||
::DeleteObject(mDefFont);
|
VERIFY(::DeleteObject(mDefFont));
|
||||||
mDefFont = NULL;
|
mDefFont = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,12 +416,13 @@ nsRenderingContextWin :: ~nsRenderingContextWin()
|
||||||
::SelectObject(mDC, mOrigSolidPen);
|
::SelectObject(mDC, mOrigSolidPen);
|
||||||
mOrigSolidPen = NULL;
|
mOrigSolidPen = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (NULL != mCurrBrush)
|
if (NULL != mCurrBrush)
|
||||||
::DeleteObject(mCurrBrush);
|
VERIFY(::DeleteObject(mCurrBrush));
|
||||||
|
|
||||||
if ((NULL != mBlackBrush) && (mBlackBrush != mCurrBrush))
|
if ((NULL != mBlackBrush) && (mBlackBrush != mCurrBrush))
|
||||||
::DeleteObject(mBlackBrush);
|
VERIFY(::DeleteObject(mBlackBrush));
|
||||||
|
|
||||||
mCurrBrush = NULL;
|
mCurrBrush = NULL;
|
||||||
mBlackBrush = NULL;
|
mBlackBrush = NULL;
|
||||||
|
@ -434,18 +431,17 @@ nsRenderingContextWin :: ~nsRenderingContextWin()
|
||||||
mCurrFont = NULL;
|
mCurrFont = NULL;
|
||||||
|
|
||||||
if (NULL != mCurrPen)
|
if (NULL != mCurrPen)
|
||||||
::DeleteObject(mCurrPen);
|
VERIFY(::DeleteObject(mCurrPen));
|
||||||
|
|
||||||
if ((NULL != mBlackPen) && (mBlackPen != mCurrPen))
|
if ((NULL != mBlackPen) && (mBlackPen != mCurrPen))
|
||||||
::DeleteObject(mBlackPen);
|
VERIFY(::DeleteObject(mBlackPen));
|
||||||
|
|
||||||
if ((NULL != mNullPen) && (mNullPen != mCurrPen))
|
if ((NULL != mNullPen) && (mNullPen != mCurrPen))
|
||||||
::DeleteObject(mNullPen);
|
VERIFY(::DeleteObject(mNullPen));
|
||||||
|
|
||||||
mCurrPen = NULL;
|
mCurrPen = NULL;
|
||||||
mBlackPen = NULL;
|
mBlackPen = NULL;
|
||||||
mNullPen = NULL;
|
mNullPen = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
if (nsnull != mStateCache)
|
if (nsnull != mStateCache)
|
||||||
{
|
{
|
||||||
|
@ -481,7 +477,6 @@ nsRenderingContextWin :: ~nsRenderingContextWin()
|
||||||
mTMatrix = nsnull;
|
mTMatrix = nsnull;
|
||||||
mDC = NULL;
|
mDC = NULL;
|
||||||
mMainDC = NULL;
|
mMainDC = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -1788,7 +1783,7 @@ HBRUSH nsRenderingContextWin :: SetupSolidBrush(void)
|
||||||
::SelectObject(mDC, tbrush);
|
::SelectObject(mDC, tbrush);
|
||||||
|
|
||||||
if (NULL != mCurrBrush)
|
if (NULL != mCurrBrush)
|
||||||
::DeleteObject(mCurrBrush);
|
VERIFY(::DeleteObject(mCurrBrush));
|
||||||
|
|
||||||
mStates->mSolidBrush = mCurrBrush = tbrush;
|
mStates->mSolidBrush = mCurrBrush = tbrush;
|
||||||
mStates->mBrushColor = mCurrBrushColor = mCurrentColor;
|
mStates->mBrushColor = mCurrBrushColor = mCurrentColor;
|
||||||
|
@ -1861,7 +1856,7 @@ HPEN nsRenderingContextWin :: SetupSolidPen(void)
|
||||||
::SelectObject(mDC, tpen);
|
::SelectObject(mDC, tpen);
|
||||||
|
|
||||||
if (NULL != mCurrPen)
|
if (NULL != mCurrPen)
|
||||||
::DeleteObject(mCurrPen);
|
VERIFY(::DeleteObject(mCurrPen));
|
||||||
|
|
||||||
mStates->mSolidPen = mCurrPen = tpen;
|
mStates->mSolidPen = mCurrPen = tpen;
|
||||||
mStates->mPenColor = mCurrPenColor = mCurrentColor;
|
mStates->mPenColor = mCurrPenColor = mCurrentColor;
|
||||||
|
@ -1880,7 +1875,7 @@ HPEN nsRenderingContextWin :: SetupDashedPen(void)
|
||||||
::SelectObject(mDC, tpen);
|
::SelectObject(mDC, tpen);
|
||||||
|
|
||||||
if (NULL != mCurrPen)
|
if (NULL != mCurrPen)
|
||||||
::DeleteObject(mCurrPen);
|
VERIFY(::DeleteObject(mCurrPen));
|
||||||
|
|
||||||
mStates->mDashedPen = mCurrPen = tpen;
|
mStates->mDashedPen = mCurrPen = tpen;
|
||||||
mStates->mPenColor = mCurrPenColor = mCurrentColor;
|
mStates->mPenColor = mCurrPenColor = mCurrentColor;
|
||||||
|
@ -1899,7 +1894,7 @@ HPEN nsRenderingContextWin :: SetupDottedPen(void)
|
||||||
::SelectObject(mDC, tpen);
|
::SelectObject(mDC, tpen);
|
||||||
|
|
||||||
if (NULL != mCurrPen)
|
if (NULL != mCurrPen)
|
||||||
::DeleteObject(mCurrPen);
|
VERIFY(::DeleteObject(mCurrPen));
|
||||||
|
|
||||||
mStates->mDottedPen = mCurrPen = tpen;
|
mStates->mDottedPen = mCurrPen = tpen;
|
||||||
mStates->mPenColor = mCurrPenColor = mCurrentColor;
|
mStates->mPenColor = mCurrPenColor = mCurrentColor;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче