From 6717a9e799168c4f7a238bf96860ebec894d7be9 Mon Sep 17 00:00:00 2001 From: "pavlov%pavlov.net" Date: Sun, 14 Mar 1999 23:14:35 +0000 Subject: [PATCH] fix mem leaks. --- widget/src/gtk/nsGtkEventHandler.cpp | 1 + widget/src/gtk/nsLookAndFeel.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/widget/src/gtk/nsGtkEventHandler.cpp b/widget/src/gtk/nsGtkEventHandler.cpp index 94a115a0d16..ac5bcce4947 100644 --- a/widget/src/gtk/nsGtkEventHandler.cpp +++ b/widget/src/gtk/nsGtkEventHandler.cpp @@ -334,6 +334,7 @@ idle_resize_cb(gpointer data) // info->widget); info->widget->OnResize(*info->rect); NS_RELEASE(info->widget); + // FIXME free info->rect g_free(info); // this will return 0 if the list is // empty. that will remove this idle timeout. diff --git a/widget/src/gtk/nsLookAndFeel.cpp b/widget/src/gtk/nsLookAndFeel.cpp index 27c30ead201..7f4b9e62cde 100644 --- a/widget/src/gtk/nsLookAndFeel.cpp +++ b/widget/src/gtk/nsLookAndFeel.cpp @@ -113,9 +113,13 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) { GtkRequisition req; GtkWidget *text = gtk_entry_new(); + // needed to avoid memory leak + gtk_widget_ref(text); + gtk_object_sink(GTK_OBJECT(text)); gtk_widget_size_request(text,&req); aMetric = req.height; gtk_widget_destroy(text); + gtk_widget_unref(text); } break; case eMetric_TextVerticalInsidePadding: