guard against multiple destroys

2003-05-14  JP Rosevear  <jpr@ximian.com>

	* gui/e-tasks.c (e_tasks_destroy): guard against multiple destroys

	* cal-client/cal-client.c (cal_client_finalize): unref the
	bonobo listener

	* gui/gnome-cal.c (gnome_calendar_destroy): guard against multiple
	destroy calls

	* gui/e-week-view.c (e_week_view_init): connect after destroy
	(invisible_destroyed): don't unref, its already destroyed

	* gui/e-day-view.c (e_day_view_init): connect after destroy
	(invisible_destroyed): don't unref, its already destroyed

	* gui/e-calendar-table.c (e_calendar_table_class_init): make sure
	we set the parent class
	(e_calendar_table_init): connect after the destroy handler runs
	(e_calendar_table_destroy): guard against multiple destroys
	(invisible_destroyed): don't unref the invisible, its already
	being destroyed

	* gui/calendar-offline-handler.c (backend_cal_set_mode): unref the
	client, we are done with it now
	(backend_cal_opened_online): ditto
	(impl_dispose): unref our main client

	* gui/calendar-commands.c (control_util_set_folder_bar_label):
	release/unref the shell view once we are done with it
	(control_util_show_settings): ditto

svn path=/trunk/; revision=21180
This commit is contained in:
JP Rosevear
2003-05-14 18:45:55 +00:00
committed by JP Rosevear
parent 0203f5de76
commit 352d3c7d3b
9 changed files with 113 additions and 69 deletions

View File

@ -1,3 +1,35 @@
2003-05-14 JP Rosevear <jpr@ximian.com>
* gui/e-tasks.c (e_tasks_destroy): guard against multiple destroys
* cal-client/cal-client.c (cal_client_finalize): unref the
bonobo listener
* gui/gnome-cal.c (gnome_calendar_destroy): guard against multiple
destroy calls
* gui/e-week-view.c (e_week_view_init): connect after destroy
(invisible_destroyed): don't unref, its already destroyed
* gui/e-day-view.c (e_day_view_init): connect after destroy
(invisible_destroyed): don't unref, its already destroyed
* gui/e-calendar-table.c (e_calendar_table_class_init): make sure
we set the parent class
(e_calendar_table_init): connect after the destroy handler runs
(e_calendar_table_destroy): guard against multiple destroys
(invisible_destroyed): don't unref the invisible, its already
being destroyed
* gui/calendar-offline-handler.c (backend_cal_set_mode): unref the
client, we are done with it now
(backend_cal_opened_online): ditto
(impl_dispose): unref our main client
* gui/calendar-commands.c (control_util_set_folder_bar_label):
release/unref the shell view once we are done with it
(control_util_show_settings): ditto
2003-05-13 Rodrigo Moya <rodrigo@ximian.com>
* gui/alarm-notify/alarm-queue.c (notify_dialog_cb): fixed memory

View File

@ -425,9 +425,9 @@ cal_client_finalize (GObject *object)
client = CAL_CLIENT (object);
priv = client->priv;
/* The server unrefs the query listener, so we just NULL it out here */
if (priv->listener) {
cal_listener_stop_notification (priv->listener);
bonobo_object_unref (priv->listener);
priv->listener = NULL;
}

View File

@ -482,6 +482,8 @@ control_util_set_folder_bar_label (BonoboControl *control, char *label)
g_message ("control_util_set_folder_bar_label(): Could not set the folder bar label");
CORBA_exception_free (&ev);
bonobo_object_release_unref (shell_view, NULL);
}
void
@ -507,6 +509,8 @@ control_util_show_settings (GnomeCalendar *gcal)
g_message ("control_util_show_settings(): Could not show settings");
CORBA_exception_free (&ev);
bonobo_object_release_unref (shell_view, NULL);
}
/* Sensitizes the UI Component menu/toolbar calendar commands based on the

View File

@ -39,7 +39,7 @@ static BonoboObjectClass *parent_class = NULL;
struct _CalendarOfflineHandlerPrivate {
CalClient *client;
GNOME_Evolution_OfflineProgressListener listener_interface;
gboolean is_offline;
@ -143,6 +143,7 @@ backend_cal_set_mode (CalClient *client, CalClientSetModeStatus status, CalMode
CalendarOfflineHandler *offline_handler = data;
update_offline (offline_handler);
g_object_unref (client);
}
static void
@ -171,6 +172,7 @@ backend_cal_opened_online (CalClient *client, CalClientOpenStatus status, gpoint
}
cal_client_set_mode (client, CAL_MODE_REMOTE);
g_object_unref (client);
}
static void
@ -188,7 +190,7 @@ backend_go_offline (gpointer data, gpointer user_data)
update_offline (offline_handler);
g_object_unref (client);
return;
}
}
}
static void
@ -256,6 +258,8 @@ impl_dispose (GObject *object)
offline_handler = CALENDAR_OFFLINE_HANDLER (object);
priv = offline_handler->priv;
g_object_unref (priv->client);
if (priv->listener_interface != CORBA_OBJECT_NIL) {
CORBA_Environment ev;

View File

@ -135,6 +135,7 @@ e_calendar_table_class_init (ECalendarTableClass *class)
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
parent_class = g_type_class_peek_parent (class);
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
@ -533,8 +534,8 @@ e_calendar_table_init (ECalendarTable *cal_table)
G_CALLBACK (selection_clear_event), cal_table);
g_signal_connect (cal_table->invisible, "selection_received",
G_CALLBACK (selection_received), cal_table);
g_signal_connect (cal_table->invisible, "destroy",
G_CALLBACK (invisible_destroyed), cal_table);
g_signal_connect_after (cal_table->invisible, "destroy",
G_CALLBACK (invisible_destroyed), cal_table);
cal_table->clipboard_selection = NULL;
}
@ -582,9 +583,11 @@ e_calendar_table_destroy (GtkObject *object)
cal_table = E_CALENDAR_TABLE (object);
g_object_unref (cal_table->model);
cal_table->model = NULL;
if (cal_table->model) {
g_object_unref (cal_table->model);
cal_table->model = NULL;
}
if (cal_table->invisible)
gtk_widget_destroy (cal_table->invisible);
if (cal_table->clipboard_selection) {
@ -1175,7 +1178,6 @@ e_calendar_table_save_state (ECalendarTable *cal_table,
static void
invisible_destroyed (GtkWidget *invisible, ECalendarTable *cal_table)
{
g_object_unref (cal_table->invisible);
cal_table->invisible = NULL;
}

View File

@ -843,8 +843,8 @@ e_day_view_init (EDayView *day_view)
G_CALLBACK (selection_clear_event), (gpointer) day_view);
g_signal_connect (day_view->invisible, "selection_received",
G_CALLBACK (selection_received), (gpointer) day_view);
g_signal_connect (day_view->invisible, "destroy",
G_CALLBACK (invisible_destroyed), (gpointer) day_view);
g_signal_connect_after (day_view->invisible, "destroy",
G_CALLBACK (invisible_destroyed), (gpointer) day_view);
day_view->clipboard_selection = NULL;
@ -7574,7 +7574,6 @@ e_day_view_get_time_string_width (EDayView *day_view)
static void
invisible_destroyed (GtkWidget *invisible, EDayView *day_view)
{
g_object_unref (day_view->invisible);
day_view->invisible = NULL;
}

View File

@ -306,16 +306,18 @@ e_tasks_destroy (GtkObject *object)
tasks = E_TASKS (object);
priv = tasks->priv;
if (priv->client) {
g_object_unref (priv->client);
priv->client = NULL;
if (priv) {
if (priv->client) {
g_object_unref (priv->client);
priv->client = NULL;
}
g_free (priv);
tasks->priv = NULL;
all_tasks = g_list_remove (all_tasks, tasks);
}
g_free (priv);
tasks->priv = NULL;
all_tasks = g_list_remove (all_tasks, tasks);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}

View File

@ -434,8 +434,8 @@ e_week_view_init (EWeekView *week_view)
G_CALLBACK (selection_clear_event), (gpointer) week_view);
g_signal_connect (week_view->invisible, "selection_received",
G_CALLBACK (selection_received), (gpointer) week_view);
g_signal_connect (week_view->invisible, "destroy",
G_CALLBACK (invisible_destroyed), (gpointer) week_view);
g_signal_connect_after (week_view->invisible, "destroy",
G_CALLBACK (invisible_destroyed), (gpointer) week_view);
week_view->clipboard_selection = NULL;
@ -4220,7 +4220,6 @@ e_week_view_get_time_string_width (EWeekView *week_view)
static void
invisible_destroyed (GtkWidget *invisible, EWeekView *week_view)
{
gtk_object_unref (GTK_OBJECT (week_view->invisible));
week_view->invisible = NULL;
}

View File

@ -916,56 +916,58 @@ gnome_calendar_destroy (GtkObject *object)
gcal = GNOME_CALENDAR (object);
priv = gcal->priv;
free_categories (priv->cal_categories);
priv->cal_categories = NULL;
if (priv) {
free_categories (priv->cal_categories);
priv->cal_categories = NULL;
free_categories (priv->tasks_categories);
priv->tasks_categories = NULL;
free_categories (priv->tasks_categories);
priv->tasks_categories = NULL;
/* Save the TaskPad layout. */
filename = g_strdup_printf ("%s/config/TaskPad", evolution_dir);
e_calendar_table_save_state (E_CALENDAR_TABLE (priv->todo), filename);
g_free (filename);
/* Save the TaskPad layout. */
filename = g_strdup_printf ("%s/config/TaskPad", evolution_dir);
e_calendar_table_save_state (E_CALENDAR_TABLE (priv->todo), filename);
g_free (filename);
if (priv->dn_query) {
g_signal_handlers_disconnect_matched (priv->dn_query, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
g_object_unref (priv->dn_query);
priv->dn_query = NULL;
if (priv->dn_query) {
g_signal_handlers_disconnect_matched (priv->dn_query, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
g_object_unref (priv->dn_query);
priv->dn_query = NULL;
}
if (priv->sexp) {
g_free (priv->sexp);
priv->sexp = NULL;
}
if (priv->client) {
g_signal_handlers_disconnect_matched (priv->client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
g_object_unref (priv->client);
priv->client = NULL;
}
if (priv->task_pad_client) {
g_signal_handlers_disconnect_matched (priv->task_pad_client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
g_object_unref (priv->task_pad_client);
priv->task_pad_client = NULL;
}
if (priv->view_instance) {
g_object_unref (priv->view_instance);
priv->view_instance = NULL;
}
if (priv->view_menus) {
g_object_unref (priv->view_menus);
priv->view_menus = NULL;
}
g_free (priv);
gcal->priv = NULL;
}
if (priv->sexp) {
g_free (priv->sexp);
priv->sexp = NULL;
}
if (priv->client) {
g_signal_handlers_disconnect_matched (priv->client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
g_object_unref (priv->client);
priv->client = NULL;
}
if (priv->task_pad_client) {
g_signal_handlers_disconnect_matched (priv->task_pad_client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
g_object_unref (priv->task_pad_client);
priv->task_pad_client = NULL;
}
if (priv->view_instance) {
g_object_unref (priv->view_instance);
priv->view_instance = NULL;
}
if (priv->view_menus) {
g_object_unref (priv->view_menus);
priv->view_menus = NULL;
}
g_free (priv);
gcal->priv = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}