fix memory leak documented in bug #29945. actually use refcnting the way it is supposed to be. r=pavlov

This commit is contained in:
blizzard%redhat.com 2000-03-04 05:04:33 +00:00
parent 73779b037b
commit 918d3b4c4e
4 changed files with 15 additions and 6 deletions

View File

@ -231,7 +231,7 @@ nsWindow::DestroyNative(void)
mSuperWin = nsnull;
}
else if(mSuperWin) {
gdk_superwin_destroy(mSuperWin);
gtk_object_unref(GTK_OBJECT(mSuperWin));
mSuperWin = NULL;
}
}

View File

@ -24,6 +24,7 @@ static void gdk_superwin_expose_area (GdkSuperWin *superwin,
gint y,
gint width,
gint height);
static void gdk_superwin_destroy(GtkObject *object);
static int gdk_superwin_clear_rect_queue(GdkSuperWin *superwin, XEvent *xevent);
static void gdk_superwin_clear_translate_queue(GdkSuperWin *superwin, unsigned long serial);
@ -77,9 +78,8 @@ gdk_superwin_class_init(GdkSuperWinClass *klass)
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS(klass);
object_class->destroy = gdk_superwin_destroy;
/* XXX do we need a finalize in here to destroy the
window? */
}
static void
@ -170,8 +170,18 @@ gdk_superwin_new (GdkWindow *parent_window,
/* XXX this should really be part of the object... */
/* XXX and it should chain up to the object's destructor */
void gdk_superwin_destroy(GdkSuperWin *superwin)
void gdk_superwin_destroy(GtkObject *object)
{
GdkSuperWin *superwin = NULL;
g_return_if_fail(object != NULL);
g_return_if_fail(GTK_IS_OBJECT(object));
g_return_if_fail(GTK_OBJECT_CONSTRUCTED(object));
g_return_if_fail(GDK_IS_SUPERWIN(object));
superwin = GDK_SUPERWIN(object);
gdk_window_remove_filter(superwin->shell_window,
gdk_superwin_shell_filter,
superwin);

View File

@ -88,7 +88,6 @@ void gdk_superwin_scroll (GdkSuperWin *superwin,
void gdk_superwin_resize (GdkSuperWin *superwin,
gint width,
gint height);
void gdk_superwin_destroy(GdkSuperWin *superwin);
#ifdef __cplusplus
}

View File

@ -107,7 +107,7 @@ gtk_mozarea_unrealize(GtkWidget *widget)
mozarea = GTK_MOZAREA(widget);
if (mozarea->superwin) {
gdk_superwin_destroy(mozarea->superwin);
gtk_object_unref(GTK_OBJECT(mozarea->superwin));
mozarea->superwin = NULL;
}
GTK_WIDGET_CLASS(parent_class)->unrealize(widget);