diff options
author | Owen Taylor <otaylor@redhat.com> | 2000-11-18 16:48:39 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-11-18 16:48:39 +0000 |
commit | 1f74dcee1b000dd8e5550154fa30fcda09300d22 (patch) | |
tree | 621a54fc6b24b6dc884b5c0a49236af9478ab4fa /gtk | |
parent | 0204bd1cef9ba557e9115617a9bace926d019d37 (diff) | |
download | gtk+-1f74dcee1b000dd8e5550154fa30fcda09300d22.tar.gz |
Patch from ChiDeok Hwang to fix memleaks found by Evan Martin.
Sat Nov 18 11:45:09 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalendar.c: Patch from ChiDeok Hwang to fix
memleaks found by Evan Martin.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkcalendar.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 5403611235..0a5b283ea8 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -262,6 +262,7 @@ typedef void (*GtkCalendarSignalDate) (GtkObject *object, guint arg1, guint arg2 static void gtk_calendar_class_init (GtkCalendarClass *class); static void gtk_calendar_init (GtkCalendar *calendar); +static void gtk_calendar_destroy (GtkObject *calendar); static void gtk_calendar_realize (GtkWidget *widget); static void gtk_calendar_unrealize (GtkWidget *widget); static void gtk_calendar_draw_focus (GtkWidget *widget); @@ -370,6 +371,7 @@ gtk_calendar_class_init (GtkCalendarClass *class) widget_class->focus_out_event = gtk_calendar_focus_out; widget_class->style_set = gtk_calendar_style_set; widget_class->state_changed = gtk_calendar_state_changed; + object_class->destroy = gtk_calendar_destroy; gtk_calendar_signals[MONTH_CHANGED_SIGNAL] = gtk_signal_new ("month_changed", @@ -1147,6 +1149,16 @@ gtk_calendar_unrealize (GtkWidget *widget) gdk_window_destroy (private_data->main_win); private_data->main_win = NULL; } + if (private_data->day_name_win) + { + gdk_window_set_user_data (private_data->day_name_win, NULL); + gdk_window_destroy (private_data->day_name_win); + private_data->day_name_win = NULL; + } + if (calendar->xor_gc) + gdk_gc_unref (calendar->xor_gc); + if (calendar->gc) + gdk_gc_unref (calendar->gc); if (GTK_WIDGET_CLASS (parent_class)->unrealize) (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); @@ -2646,6 +2658,16 @@ gtk_calendar_focus_in (GtkWidget *widget, return FALSE; } +static void +gtk_calendar_destroy (GtkObject *object) +{ + GtkCalendarPrivateData *private_data; + private_data = GTK_CALENDAR_PRIVATE_DATA (object); + g_free (private_data); + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); +} + static gint gtk_calendar_focus_out (GtkWidget *widget, GdkEventFocus *event) |