bug 210713: [gtk2] leaks in nsWindow and nsAppShell.

r+sr=blizzard.
This commit is contained in:
dwitte%stanford.edu 2003-07-02 19:27:38 +00:00
parent bfc281cacf
commit 2d360fcd0c
5 changed files with 32 additions and 0 deletions

View File

@ -96,6 +96,19 @@ nsAppShell::~nsAppShell(void)
{
}
/* static */ void
nsAppShell::ReleaseGlobals()
{
if (sQueueHashTable) {
PL_HashTableDestroy(sQueueHashTable);
sQueueHashTable = nsnull;
}
if (sCountHashTable) {
PL_HashTableDestroy(sCountHashTable);
sCountHashTable = nsnull;
}
}
NS_IMPL_ISUPPORTS1(nsAppShell, nsIAppShell)
NS_IMETHODIMP

View File

@ -49,6 +49,8 @@ public:
nsAppShell();
virtual ~nsAppShell();
static void ReleaseGlobals();
NS_DECL_ISUPPORTS
NS_DECL_NSIAPPSHELL

View File

@ -119,6 +119,8 @@ static const nsModuleComponentInfo components[] =
PR_STATIC_CALLBACK(void)
nsWidgetGtk2ModuleDtor(nsIModule *aSelf)
{
nsWindow::ReleaseGlobals();
nsAppShell::ReleaseGlobals();
}
NS_IMPL_NSGETMODULE_WITH_DTOR(nsWidgetGtk2Module,

View File

@ -218,6 +218,8 @@ static GtkIMContext *IM_get_input_context(MozDrawingarea *aArea);
// cursor cache
GdkCursor *gCursorCache[eCursorCount];
#define ARRAY_LENGTH(a) (sizeof(a)/sizeof(a[0]))
nsWindow::nsWindow()
{
mContainer = nsnull;
@ -273,6 +275,17 @@ nsWindow::~nsWindow()
Destroy();
}
/* static */ void
nsWindow::ReleaseGlobals()
{
for (PRUint32 i = 0; i < ARRAY_LENGTH(gCursorCache); ++i) {
if (gCursorCache[i]) {
gdk_cursor_unref(gCursorCache[i]);
gCursorCache[i] = nsnull;
}
}
}
NS_IMPL_ISUPPORTS_INHERITED1(nsWindow, nsCommonWidget,
nsISupportsWeakReference)

View File

@ -67,6 +67,8 @@ public:
nsWindow();
virtual ~nsWindow();
static void ReleaseGlobals();
NS_DECL_ISUPPORTS_INHERITED
// nsIWidget