diff options
author | Michael Meeks <michael@ximian.com> | 2001-12-12 20:14:52 +0000 |
---|---|---|
committer | Michael Meeks <michael@src.gnome.org> | 2001-12-12 20:14:52 +0000 |
commit | f9769d4cd3a5e9fb3784b45a356cbd9a1d718e14 (patch) | |
tree | dc9a5aa9e8fd4a36876424be881be14730e7f0ea /src | |
parent | 57b746384ea0caba39590822e272ecce8ae6a805 (diff) | |
download | nautilus-f9769d4cd3a5e9fb3784b45a356cbd9a1d718e14.tar.gz |
protect vs. double destroy.
2001-12-12 Michael Meeks <michael@ximian.com>
* src/nautilus-window.c (nautilus_window_destroy):
protect vs. double destroy.
* src/nautilus-window-manage-views.c (disconnect_view):
start macro definitions on the first line.
* src/nautilus-sidebar.c (nautilus_sidebar_destroy):
protect vs. double destroy.
* src/nautilus-sidebar-tabs.c
(nautilus_sidebar_tabs_destroy): protect vs. double destroy
and theoretical re-enterancy hazard.
* src/nautilus-sidebar-title.c
(nautilus_sidebar_title_destroy): protect vs. double
destroys.
* src/nautilus-application.c (create_object): re-enable
list view.
* src/file-manager/fm-list-view.c: re-enable.
Diffstat (limited to 'src')
-rw-r--r-- | src/file-manager/fm-list-view.c | 36 | ||||
-rw-r--r-- | src/nautilus-application.c | 2 | ||||
-rw-r--r-- | src/nautilus-information-panel.c | 35 | ||||
-rw-r--r-- | src/nautilus-navigation-window.c | 87 | ||||
-rw-r--r-- | src/nautilus-object-window.c | 87 | ||||
-rw-r--r-- | src/nautilus-sidebar-tabs.c | 53 | ||||
-rw-r--r-- | src/nautilus-sidebar-title.c | 9 | ||||
-rw-r--r-- | src/nautilus-sidebar.c | 35 | ||||
-rw-r--r-- | src/nautilus-spatial-window.c | 87 | ||||
-rw-r--r-- | src/nautilus-window-manage-views.c | 4 | ||||
-rw-r--r-- | src/nautilus-window.c | 87 |
11 files changed, 273 insertions, 249 deletions
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index ba02c398e..4f9f930c3 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -49,10 +49,6 @@ #include <libnautilus-private/nautilus-icon-factory.h> #include <libnautilus-private/nautilus-metadata.h> -/* Turn this whole file off until we finish with EelList and EelCList or port. */ - -#if GNOME2_CONVERSION_COMPLETE - struct FMListViewDetails { int sort_column; gboolean sort_reversed; @@ -272,25 +268,25 @@ fm_list_view_init (gpointer object, gpointer klass) GTK_OBJECT (list_view)); eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_LIST_VIEW_FONT, - font_or_font_size_changed_callback, - list_view, - GTK_OBJECT (list_view)); + font_or_font_size_changed_callback, + list_view, + G_OBJECT (list_view)); eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER, - default_sort_criteria_changed_callback, - list_view, - GTK_OBJECT (list_view)); + default_sort_criteria_changed_callback, + list_view, + G_OBJECT (list_view)); eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL, - default_zoom_level_changed_callback, - list_view, - GTK_OBJECT (list_view)); + default_zoom_level_changed_callback, + list_view, + G_OBJECT (list_view)); eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER, - default_sort_criteria_changed_callback, - list_view, - GTK_OBJECT (list_view)); + default_sort_criteria_changed_callback, + list_view, + G_OBJECT (list_view)); eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE, - font_or_font_size_changed_callback, - list_view, - GTK_OBJECT (list_view)); + font_or_font_size_changed_callback, + list_view, + G_OBJECT (list_view)); /* It's important to not create the EelList (with a call * to create_list) until later, when the function pointers @@ -2279,5 +2275,3 @@ real_get_column_specification (FMListView *view, g_assert_not_reached (); } } - -#endif diff --git a/src/nautilus-application.c b/src/nautilus-application.c index 1a4e2e6f9..3812064e0 100644 --- a/src/nautilus-application.c +++ b/src/nautilus-application.c @@ -113,10 +113,10 @@ create_object (PortableServer_Servant servant, } else if (strcmp (iid, NAUTILUS_DESKTOP_ICON_VIEW_IID) == 0) { directory_view = FM_DIRECTORY_VIEW (g_object_new (fm_desktop_icon_view_get_type (), NULL)); object = BONOBO_OBJECT (fm_directory_view_get_nautilus_view (directory_view)); -#if GNOME2_CONVERSION_COMPLETE } else if (strcmp (iid, NAUTILUS_LIST_VIEW_IID) == 0) { directory_view = FM_DIRECTORY_VIEW (g_object_new (fm_list_view_get_type (), NULL)); object = BONOBO_OBJECT (fm_directory_view_get_nautilus_view (directory_view)); +#if GNOME2_CONVERSION_COMPLETE } else if (strcmp (iid, SEARCH_LIST_VIEW_IID) == 0) { directory_view = FM_DIRECTORY_VIEW (g_object_new (fm_search_list_view_get_type (), NULL)); object = BONOBO_OBJECT (fm_directory_view_get_nautilus_view (directory_view)); diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c index a85d7090d..76827e458 100644 --- a/src/nautilus-information-panel.c +++ b/src/nautilus-information-panel.c @@ -304,23 +304,26 @@ nautilus_sidebar_destroy (GtkObject *object) sidebar = NAUTILUS_SIDEBAR (object); - g_object_unref (sidebar->details->notebook); - - if (sidebar->details->file != NULL) { - gtk_signal_disconnect (GTK_OBJECT (sidebar->details->file), - sidebar->details->file_changed_connection); - nautilus_file_monitor_remove (sidebar->details->file, sidebar); - nautilus_file_unref (sidebar->details->file); + if (sidebar->details) { + g_object_unref (sidebar->details->notebook); + + if (sidebar->details->file != NULL) { + gtk_signal_disconnect (GTK_OBJECT (sidebar->details->file), + sidebar->details->file_changed_connection); + nautilus_file_monitor_remove (sidebar->details->file, sidebar); + nautilus_file_unref (sidebar->details->file); + } + + gtk_object_sink (GTK_OBJECT (sidebar->details->title_tab)); + + g_free (sidebar->details->uri); + g_free (sidebar->details->default_background_color); + g_free (sidebar->details->default_background_image); + + g_free (sidebar->details); + sidebar->details = NULL; } - - gtk_object_sink (GTK_OBJECT (sidebar->details->title_tab)); - - g_free (sidebar->details->uri); - g_free (sidebar->details->default_background_color); - g_free (sidebar->details->default_background_image); - - g_free (sidebar->details); - + eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, nautilus_sidebar_theme_changed, sidebar); diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c index 28a8e0586..089c7057e 100644 --- a/src/nautilus-navigation-window.c +++ b/src/nautilus-navigation-window.c @@ -880,63 +880,66 @@ nautilus_window_destroy (GtkObject *object) window = NAUTILUS_WINDOW (object); - /* Handle the part of destroy that's private to the view - * management. - */ - nautilus_window_manage_views_destroy (window); + if (window->details != NULL) { + /* Handle the part of destroy that's private to the view + * management. + */ + nautilus_window_manage_views_destroy (window); - /* Get rid of all callbacks. */ - nautilus_window_set_viewed_file (window, NULL); - nautilus_window_remove_bookmarks_menu_callback (window); - nautilus_window_remove_go_menu_callback (window); - nautilus_window_toolbar_remove_theme_callback (window); + /* Get rid of all callbacks. */ + nautilus_window_set_viewed_file (window, NULL); + nautilus_window_remove_bookmarks_menu_callback (window); + nautilus_window_remove_go_menu_callback (window); + nautilus_window_toolbar_remove_theme_callback (window); - if (window->details->ui_idle_id != 0) { - gtk_idle_remove (window->details->ui_idle_id); - } + if (window->details->ui_idle_id != 0) { + gtk_idle_remove (window->details->ui_idle_id); + } - /* Get rid of all owned objects. */ + /* Get rid of all owned objects. */ - if (window->details->shell_ui != NULL) { - bonobo_ui_component_unset_container (window->details->shell_ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui)); - } + if (window->details->shell_ui != NULL) { + bonobo_ui_component_unset_container (window->details->shell_ui, NULL); + bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui)); + } - nautilus_file_unref (window->details->viewed_file); + nautilus_file_unref (window->details->viewed_file); - g_list_free (window->sidebar_panels); + g_list_free (window->sidebar_panels); - free_stored_viewers (window); + free_stored_viewers (window); - g_free (window->details->location); - eel_g_list_free_deep (window->details->selection); - eel_g_list_free_deep (window->details->pending_selection); + g_free (window->details->location); + eel_g_list_free_deep (window->details->selection); + eel_g_list_free_deep (window->details->pending_selection); - nautilus_window_clear_back_list (window); - nautilus_window_clear_forward_list (window); + nautilus_window_clear_back_list (window); + nautilus_window_clear_forward_list (window); - if (window->current_location_bookmark != NULL) { - g_object_unref (window->current_location_bookmark); - } - if (window->last_location_bookmark != NULL) { - g_object_unref (window->last_location_bookmark); - } + if (window->current_location_bookmark != NULL) { + g_object_unref (window->current_location_bookmark); + } + if (window->last_location_bookmark != NULL) { + g_object_unref (window->last_location_bookmark); + } - if (window->status_bar_clear_id != 0) { - g_source_remove (window->status_bar_clear_id); - } + if (window->status_bar_clear_id != 0) { + g_source_remove (window->status_bar_clear_id); + } - if (window->details->ui_container != NULL) { - bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container)); - } + if (window->details->ui_container != NULL) { + bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container)); + } - if (window->details->location_change_at_idle_id != 0) { - gtk_idle_remove (window->details->location_change_at_idle_id); - } + if (window->details->location_change_at_idle_id != 0) { + gtk_idle_remove (window->details->location_change_at_idle_id); + } - g_free (window->details->title); + g_free (window->details->title); - g_free (window->details); + g_free (window->details); + window->details = NULL; + } EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); } diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c index 28a8e0586..089c7057e 100644 --- a/src/nautilus-object-window.c +++ b/src/nautilus-object-window.c @@ -880,63 +880,66 @@ nautilus_window_destroy (GtkObject *object) window = NAUTILUS_WINDOW (object); - /* Handle the part of destroy that's private to the view - * management. - */ - nautilus_window_manage_views_destroy (window); + if (window->details != NULL) { + /* Handle the part of destroy that's private to the view + * management. + */ + nautilus_window_manage_views_destroy (window); - /* Get rid of all callbacks. */ - nautilus_window_set_viewed_file (window, NULL); - nautilus_window_remove_bookmarks_menu_callback (window); - nautilus_window_remove_go_menu_callback (window); - nautilus_window_toolbar_remove_theme_callback (window); + /* Get rid of all callbacks. */ + nautilus_window_set_viewed_file (window, NULL); + nautilus_window_remove_bookmarks_menu_callback (window); + nautilus_window_remove_go_menu_callback (window); + nautilus_window_toolbar_remove_theme_callback (window); - if (window->details->ui_idle_id != 0) { - gtk_idle_remove (window->details->ui_idle_id); - } + if (window->details->ui_idle_id != 0) { + gtk_idle_remove (window->details->ui_idle_id); + } - /* Get rid of all owned objects. */ + /* Get rid of all owned objects. */ - if (window->details->shell_ui != NULL) { - bonobo_ui_component_unset_container (window->details->shell_ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui)); - } + if (window->details->shell_ui != NULL) { + bonobo_ui_component_unset_container (window->details->shell_ui, NULL); + bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui)); + } - nautilus_file_unref (window->details->viewed_file); + nautilus_file_unref (window->details->viewed_file); - g_list_free (window->sidebar_panels); + g_list_free (window->sidebar_panels); - free_stored_viewers (window); + free_stored_viewers (window); - g_free (window->details->location); - eel_g_list_free_deep (window->details->selection); - eel_g_list_free_deep (window->details->pending_selection); + g_free (window->details->location); + eel_g_list_free_deep (window->details->selection); + eel_g_list_free_deep (window->details->pending_selection); - nautilus_window_clear_back_list (window); - nautilus_window_clear_forward_list (window); + nautilus_window_clear_back_list (window); + nautilus_window_clear_forward_list (window); - if (window->current_location_bookmark != NULL) { - g_object_unref (window->current_location_bookmark); - } - if (window->last_location_bookmark != NULL) { - g_object_unref (window->last_location_bookmark); - } + if (window->current_location_bookmark != NULL) { + g_object_unref (window->current_location_bookmark); + } + if (window->last_location_bookmark != NULL) { + g_object_unref (window->last_location_bookmark); + } - if (window->status_bar_clear_id != 0) { - g_source_remove (window->status_bar_clear_id); - } + if (window->status_bar_clear_id != 0) { + g_source_remove (window->status_bar_clear_id); + } - if (window->details->ui_container != NULL) { - bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container)); - } + if (window->details->ui_container != NULL) { + bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container)); + } - if (window->details->location_change_at_idle_id != 0) { - gtk_idle_remove (window->details->location_change_at_idle_id); - } + if (window->details->location_change_at_idle_id != 0) { + gtk_idle_remove (window->details->location_change_at_idle_id); + } - g_free (window->details->title); + g_free (window->details->title); - g_free (window->details); + g_free (window->details); + window->details = NULL; + } EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); } diff --git a/src/nautilus-sidebar-tabs.c b/src/nautilus-sidebar-tabs.c index df4f4cfa2..735f0d4a9 100644 --- a/src/nautilus-sidebar-tabs.c +++ b/src/nautilus-sidebar-tabs.c @@ -348,7 +348,7 @@ static void tab_item_destroy (TabItem *item) { Bonobo_PropertyBag property_bag; - + g_free (item->tab_text); g_free (item->indicator_pixbuf_name); @@ -379,31 +379,40 @@ tab_item_destroy_cover (gpointer item, gpointer callback_data) static void nautilus_sidebar_tabs_destroy (GtkObject *object) { - NautilusSidebarTabs *sidebar_tabs = NAUTILUS_SIDEBAR_TABS(object); - - /* deallocate the tab piece images, if any */ - if (sidebar_tabs->details->tab_piece_images[0] != NULL) { - nautilus_sidebar_tabs_unload_tab_pieces (sidebar_tabs); - } + GList *tab_items; + NautilusSidebarTabs *sidebar_tabs = NAUTILUS_SIDEBAR_TABS (object); + + if (sidebar_tabs->details) { + /* deallocate the tab piece images, if any */ + if (sidebar_tabs->details->tab_piece_images[0] != NULL) { + nautilus_sidebar_tabs_unload_tab_pieces (sidebar_tabs); + } - if (sidebar_tabs->details->tab_font != NULL) { - g_object_unref (sidebar_tabs->details->tab_font); - sidebar_tabs->details->tab_font = NULL; - } + if (sidebar_tabs->details->tab_font != NULL) { + g_object_unref (sidebar_tabs->details->tab_font); + sidebar_tabs->details->tab_font = NULL; + } - /* release the tab list, if any */ - eel_g_list_free_deep_custom (sidebar_tabs->details->tab_items, - tab_item_destroy_cover, - NULL); + /* release the tab list, if any */ + if (sidebar_tabs->details->tab_items) { + tab_items = sidebar_tabs->details->tab_items; + sidebar_tabs->details->tab_items = NULL; + + eel_g_list_free_deep_custom (tab_items, + tab_item_destroy_cover, + NULL); + } - eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, - (EelPreferencesCallback) nautilus_sidebar_tabs_load_theme_data, - sidebar_tabs); - eel_preferences_remove_callback (NAUTILUS_PREFERENCES_DEFAULT_SMOOTH_FONT, - smooth_font_changed_callback, - sidebar_tabs); + eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, + (EelPreferencesCallback) nautilus_sidebar_tabs_load_theme_data, + sidebar_tabs); + eel_preferences_remove_callback (NAUTILUS_PREFERENCES_DEFAULT_SMOOTH_FONT, + smooth_font_changed_callback, + sidebar_tabs); - g_free (sidebar_tabs->details); + g_free (sidebar_tabs->details); + sidebar_tabs->details = NULL; + } EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); } diff --git a/src/nautilus-sidebar-title.c b/src/nautilus-sidebar-title.c index bd90a824a..01033a48c 100644 --- a/src/nautilus-sidebar-title.c +++ b/src/nautilus-sidebar-title.c @@ -292,10 +292,13 @@ nautilus_sidebar_title_destroy (GtkObject *object) sidebar_title = NAUTILUS_SIDEBAR_TITLE (object); - release_file (sidebar_title); + if (sidebar_title->details) { + release_file (sidebar_title); - g_free (sidebar_title->details->title_text); - g_free (sidebar_title->details); + g_free (sidebar_title->details->title_text); + g_free (sidebar_title->details); + sidebar_title->details = NULL; + } EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); } diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c index a85d7090d..76827e458 100644 --- a/src/nautilus-sidebar.c +++ b/src/nautilus-sidebar.c @@ -304,23 +304,26 @@ nautilus_sidebar_destroy (GtkObject *object) sidebar = NAUTILUS_SIDEBAR (object); - g_object_unref (sidebar->details->notebook); - - if (sidebar->details->file != NULL) { - gtk_signal_disconnect (GTK_OBJECT (sidebar->details->file), - sidebar->details->file_changed_connection); - nautilus_file_monitor_remove (sidebar->details->file, sidebar); - nautilus_file_unref (sidebar->details->file); + if (sidebar->details) { + g_object_unref (sidebar->details->notebook); + + if (sidebar->details->file != NULL) { + gtk_signal_disconnect (GTK_OBJECT (sidebar->details->file), + sidebar->details->file_changed_connection); + nautilus_file_monitor_remove (sidebar->details->file, sidebar); + nautilus_file_unref (sidebar->details->file); + } + + gtk_object_sink (GTK_OBJECT (sidebar->details->title_tab)); + + g_free (sidebar->details->uri); + g_free (sidebar->details->default_background_color); + g_free (sidebar->details->default_background_image); + + g_free (sidebar->details); + sidebar->details = NULL; } - - gtk_object_sink (GTK_OBJECT (sidebar->details->title_tab)); - - g_free (sidebar->details->uri); - g_free (sidebar->details->default_background_color); - g_free (sidebar->details->default_background_image); - - g_free (sidebar->details); - + eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, nautilus_sidebar_theme_changed, sidebar); diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c index 28a8e0586..089c7057e 100644 --- a/src/nautilus-spatial-window.c +++ b/src/nautilus-spatial-window.c @@ -880,63 +880,66 @@ nautilus_window_destroy (GtkObject *object) window = NAUTILUS_WINDOW (object); - /* Handle the part of destroy that's private to the view - * management. - */ - nautilus_window_manage_views_destroy (window); + if (window->details != NULL) { + /* Handle the part of destroy that's private to the view + * management. + */ + nautilus_window_manage_views_destroy (window); - /* Get rid of all callbacks. */ - nautilus_window_set_viewed_file (window, NULL); - nautilus_window_remove_bookmarks_menu_callback (window); - nautilus_window_remove_go_menu_callback (window); - nautilus_window_toolbar_remove_theme_callback (window); + /* Get rid of all callbacks. */ + nautilus_window_set_viewed_file (window, NULL); + nautilus_window_remove_bookmarks_menu_callback (window); + nautilus_window_remove_go_menu_callback (window); + nautilus_window_toolbar_remove_theme_callback (window); - if (window->details->ui_idle_id != 0) { - gtk_idle_remove (window->details->ui_idle_id); - } + if (window->details->ui_idle_id != 0) { + gtk_idle_remove (window->details->ui_idle_id); + } - /* Get rid of all owned objects. */ + /* Get rid of all owned objects. */ - if (window->details->shell_ui != NULL) { - bonobo_ui_component_unset_container (window->details->shell_ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui)); - } + if (window->details->shell_ui != NULL) { + bonobo_ui_component_unset_container (window->details->shell_ui, NULL); + bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui)); + } - nautilus_file_unref (window->details->viewed_file); + nautilus_file_unref (window->details->viewed_file); - g_list_free (window->sidebar_panels); + g_list_free (window->sidebar_panels); - free_stored_viewers (window); + free_stored_viewers (window); - g_free (window->details->location); - eel_g_list_free_deep (window->details->selection); - eel_g_list_free_deep (window->details->pending_selection); + g_free (window->details->location); + eel_g_list_free_deep (window->details->selection); + eel_g_list_free_deep (window->details->pending_selection); - nautilus_window_clear_back_list (window); - nautilus_window_clear_forward_list (window); + nautilus_window_clear_back_list (window); + nautilus_window_clear_forward_list (window); - if (window->current_location_bookmark != NULL) { - g_object_unref (window->current_location_bookmark); - } - if (window->last_location_bookmark != NULL) { - g_object_unref (window->last_location_bookmark); - } + if (window->current_location_bookmark != NULL) { + g_object_unref (window->current_location_bookmark); + } + if (window->last_location_bookmark != NULL) { + g_object_unref (window->last_location_bookmark); + } - if (window->status_bar_clear_id != 0) { - g_source_remove (window->status_bar_clear_id); - } + if (window->status_bar_clear_id != 0) { + g_source_remove (window->status_bar_clear_id); + } - if (window->details->ui_container != NULL) { - bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container)); - } + if (window->details->ui_container != NULL) { + bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container)); + } - if (window->details->location_change_at_idle_id != 0) { - gtk_idle_remove (window->details->location_change_at_idle_id); - } + if (window->details->location_change_at_idle_id != 0) { + gtk_idle_remove (window->details->location_change_at_idle_id); + } - g_free (window->details->title); + g_free (window->details->title); - g_free (window->details); + g_free (window->details); + window->details = NULL; + } EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); } diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c index 9f5916ed1..43e34d5e9 100644 --- a/src/nautilus-window-manage-views.c +++ b/src/nautilus-window-manage-views.c @@ -1966,11 +1966,11 @@ disconnect_view (NautilusWindow *window, NautilusViewFrame *view) view_object = GTK_OBJECT (view); - #define DISCONNECT(signal) gtk_signal_disconnect_by_func \ +#define DISCONNECT(signal) gtk_signal_disconnect_by_func \ (view_object, \ G_CALLBACK (signal##_callback), window); FOR_EACH_NAUTILUS_WINDOW_SIGNAL (DISCONNECT) - #undef DISCONNECT +#undef DISCONNECT } static void diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 28a8e0586..089c7057e 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -880,63 +880,66 @@ nautilus_window_destroy (GtkObject *object) window = NAUTILUS_WINDOW (object); - /* Handle the part of destroy that's private to the view - * management. - */ - nautilus_window_manage_views_destroy (window); + if (window->details != NULL) { + /* Handle the part of destroy that's private to the view + * management. + */ + nautilus_window_manage_views_destroy (window); - /* Get rid of all callbacks. */ - nautilus_window_set_viewed_file (window, NULL); - nautilus_window_remove_bookmarks_menu_callback (window); - nautilus_window_remove_go_menu_callback (window); - nautilus_window_toolbar_remove_theme_callback (window); + /* Get rid of all callbacks. */ + nautilus_window_set_viewed_file (window, NULL); + nautilus_window_remove_bookmarks_menu_callback (window); + nautilus_window_remove_go_menu_callback (window); + nautilus_window_toolbar_remove_theme_callback (window); - if (window->details->ui_idle_id != 0) { - gtk_idle_remove (window->details->ui_idle_id); - } + if (window->details->ui_idle_id != 0) { + gtk_idle_remove (window->details->ui_idle_id); + } - /* Get rid of all owned objects. */ + /* Get rid of all owned objects. */ - if (window->details->shell_ui != NULL) { - bonobo_ui_component_unset_container (window->details->shell_ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui)); - } + if (window->details->shell_ui != NULL) { + bonobo_ui_component_unset_container (window->details->shell_ui, NULL); + bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui)); + } - nautilus_file_unref (window->details->viewed_file); + nautilus_file_unref (window->details->viewed_file); - g_list_free (window->sidebar_panels); + g_list_free (window->sidebar_panels); - free_stored_viewers (window); + free_stored_viewers (window); - g_free (window->details->location); - eel_g_list_free_deep (window->details->selection); - eel_g_list_free_deep (window->details->pending_selection); + g_free (window->details->location); + eel_g_list_free_deep (window->details->selection); + eel_g_list_free_deep (window->details->pending_selection); - nautilus_window_clear_back_list (window); - nautilus_window_clear_forward_list (window); + nautilus_window_clear_back_list (window); + nautilus_window_clear_forward_list (window); - if (window->current_location_bookmark != NULL) { - g_object_unref (window->current_location_bookmark); - } - if (window->last_location_bookmark != NULL) { - g_object_unref (window->last_location_bookmark); - } + if (window->current_location_bookmark != NULL) { + g_object_unref (window->current_location_bookmark); + } + if (window->last_location_bookmark != NULL) { + g_object_unref (window->last_location_bookmark); + } - if (window->status_bar_clear_id != 0) { - g_source_remove (window->status_bar_clear_id); - } + if (window->status_bar_clear_id != 0) { + g_source_remove (window->status_bar_clear_id); + } - if (window->details->ui_container != NULL) { - bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container)); - } + if (window->details->ui_container != NULL) { + bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container)); + } - if (window->details->location_change_at_idle_id != 0) { - gtk_idle_remove (window->details->location_change_at_idle_id); - } + if (window->details->location_change_at_idle_id != 0) { + gtk_idle_remove (window->details->location_change_at_idle_id); + } - g_free (window->details->title); + g_free (window->details->title); - g_free (window->details); + g_free (window->details); + window->details = NULL; + } EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); } |