From 4536e0f5b38e7c97b8dc63b1acf33c1b8c077d1a Mon Sep 17 00:00:00 2001 From: Darin Adler Date: Thu, 8 Mar 2001 19:53:30 +0000 Subject: reviewed by: John Sullivan Fix another part of bug 7494 (History sidebar component spews assertions when closing nautilus window [and sometimes crashes]): * libnautilus/nautilus-idle-queue.c: (execute_queued_functions): Change logic so that queued functions no longer execute once the caller destroys the queue. Fix bug 7564 (opening and quickly closing window in list view leads to core dump): * src/file-manager/fm-directory-view.c: (fm_directory_view_destroy): Remove code to empty lists now that stop handles that. (load_error_callback): Added a FIXME about the fact that we throw away some pending files on an error. (fm_directory_view_stop): Don't display pending files any more. This is a problem when trying to destroy, and also the old code displayed only one "batch" of pending files, so it wasn't really making sure all the files were displayed anyway. If we re-add the code to display pending files here, we'll have to make sure it doesn't do this for the destroy case. * src/file-manager/fm-list-view.c: Added FIXME asking why the "add 100 items at a time" logic is only needed for list view, and not for icon view. If both kinds of views had it, it could be done more simply at the FMDirectoryView level. * libnautilus-extensions/nautilus-icon-factory.c: (nautilus_get_icon_size_for_zoom_level): Fix this code so that it doesn't do a core dump if it gets a bad size. This is not the cause of the problem, but it's good to fix this too, because a core dump is overreacting to a bad parameter. --- ChangeLog | 36 ++++++++++++++++++++++++++ libnautilus-extensions/nautilus-icon-factory.c | 4 +-- libnautilus-private/nautilus-icon-factory.c | 4 +-- libnautilus/nautilus-idle-queue.c | 4 ++- src/file-manager/fm-directory-view.c | 25 +++++++++--------- src/file-manager/fm-list-view.c | 1 + 6 files changed, 54 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5542713b4..844f0a687 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,39 @@ +2001-03-08 Darin Adler + + reviewed by: John Sullivan + + Fix another part of bug 7494 (History sidebar component spews + assertions when closing nautilus window [and sometimes crashes]): + + * libnautilus/nautilus-idle-queue.c: (execute_queued_functions): + Change logic so that queued functions no longer execute once the + caller destroys the queue. + + Fix bug 7564 (opening and quickly closing window in list view + leads to core dump): + + * src/file-manager/fm-directory-view.c: + (fm_directory_view_destroy): Remove code to empty lists now that + stop handles that. + (load_error_callback): Added a FIXME about the fact that we throw + away some pending files on an error. + (fm_directory_view_stop): Don't display pending files any more. + This is a problem when trying to destroy, and also the old code + displayed only one "batch" of pending files, so it wasn't really + making sure all the files were displayed anyway. If we re-add the + code to display pending files here, we'll have to make sure it + doesn't do this for the destroy case. + * src/file-manager/fm-list-view.c: Added FIXME asking why the "add + 100 items at a time" logic is only needed for list view, and not + for icon view. If both kinds of views had it, it could be done + more simply at the FMDirectoryView level. + + * libnautilus-extensions/nautilus-icon-factory.c: + (nautilus_get_icon_size_for_zoom_level): Fix this code so that it + doesn't do a core dump if it gets a bad size. This is not the + cause of the problem, but it's good to fix this too, because a + core dump is overreacting to a bad parameter. + 2001-03-08 Maciej Stachowiak reviewed by: Darin Adler diff --git a/libnautilus-extensions/nautilus-icon-factory.c b/libnautilus-extensions/nautilus-icon-factory.c index 31f51d20f..e86766d4d 100644 --- a/libnautilus-extensions/nautilus-icon-factory.c +++ b/libnautilus-extensions/nautilus-icon-factory.c @@ -2275,10 +2275,8 @@ nautilus_get_icon_size_for_zoom_level (NautilusZoomLevel zoom_level) return NAUTILUS_ICON_SIZE_LARGER; case NAUTILUS_ZOOM_LEVEL_LARGEST: return NAUTILUS_ICON_SIZE_LARGEST; - default: - g_assert_not_reached (); - return NAUTILUS_ICON_SIZE_STANDARD; } + g_return_val_if_fail (FALSE, NAUTILUS_ICON_SIZE_STANDARD); } /* Convenience cover for nautilus_icon_factory_get_icon_for_file diff --git a/libnautilus-private/nautilus-icon-factory.c b/libnautilus-private/nautilus-icon-factory.c index 31f51d20f..e86766d4d 100644 --- a/libnautilus-private/nautilus-icon-factory.c +++ b/libnautilus-private/nautilus-icon-factory.c @@ -2275,10 +2275,8 @@ nautilus_get_icon_size_for_zoom_level (NautilusZoomLevel zoom_level) return NAUTILUS_ICON_SIZE_LARGER; case NAUTILUS_ZOOM_LEVEL_LARGEST: return NAUTILUS_ICON_SIZE_LARGEST; - default: - g_assert_not_reached (); - return NAUTILUS_ICON_SIZE_STANDARD; } + g_return_val_if_fail (FALSE, NAUTILUS_ICON_SIZE_STANDARD); } /* Convenience cover for nautilus_icon_factory_get_icon_for_file diff --git a/libnautilus/nautilus-idle-queue.c b/libnautilus/nautilus-idle-queue.c index 11cb8d275..80d9e3b61 100644 --- a/libnautilus/nautilus-idle-queue.c +++ b/libnautilus/nautilus-idle-queue.c @@ -62,7 +62,9 @@ execute_queued_functions (gpointer callback_data) for (node = functions; node != NULL; node = node->next) { function = node->data; - (* function->callback) (function->data, function->callback_data); + if (!queue->destroy) { + (* function->callback) (function->data, function->callback_data); + } if (function->free_callback_data != NULL) { (* function->free_callback_data) (function->callback_data); } diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 64f0aa1f4..fd0d94c13 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -1099,13 +1099,6 @@ fm_directory_view_destroy (GtkObject *object) monitor_file_for_activation (view, NULL); - nautilus_file_list_free (view->details->pending_files_added); - view->details->pending_files_added = NULL; - nautilus_file_list_free (view->details->pending_files_changed); - view->details->pending_files_changed = NULL; - nautilus_g_list_free_deep (view->details->pending_uris_selected); - view->details->pending_uris_selected = NULL; - monitor_file_for_open_with (view, NULL); fm_directory_view_stop (view); @@ -1384,7 +1377,6 @@ stop_loading_callback (NautilusView *nautilus_view, fm_directory_view_stop (view); } - static void fm_directory_view_file_limit_reached (FMDirectoryView *view) { @@ -2005,11 +1997,16 @@ load_error_callback (NautilusDirectory *directory, view = FM_DIRECTORY_VIEW (callback_data); + /* FIXME: By doing a stop, we discard some pending files. Is + * that OK? + */ fm_directory_view_stop (view); - /* Emit a signal to tell subclasses that a load - error has occurred, so they can handle it in the - UI */ - gtk_signal_emit (GTK_OBJECT (view), signals[LOAD_ERROR], load_error_code); + + /* Emit a signal to tell subclasses that a load error has + * occurred, so they can handle it in the UI. + */ + gtk_signal_emit (GTK_OBJECT (view), + signals[LOAD_ERROR], load_error_code); } static void @@ -4120,12 +4117,14 @@ fm_directory_view_stop (FMDirectoryView *view) g_return_if_fail (FM_IS_DIRECTORY_VIEW (view)); unschedule_display_of_pending_files (view); - display_pending_files (view); + /* Free extra undisplayed files */ nautilus_file_list_free (view->details->pending_files_added); view->details->pending_files_added = NULL; nautilus_file_list_free (view->details->pending_files_changed); view->details->pending_files_changed = NULL; + nautilus_g_list_free_deep (view->details->pending_uris_selected); + view->details->pending_uris_selected = NULL; if (view->details->model != NULL) { nautilus_directory_file_monitor_remove (view->details->model, view); diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index 0217ba613..e7fc59a32 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -60,6 +60,7 @@ struct FMListViewDetails { in chunks, to improve responsiveness during loading. This is the number of files we add to the list, or change at once. */ +/* FIXME: Why doesn't the icon view need the same thing. */ #define LIST_VIEW_DISPLAY_PENDING_FILES_GROUP_SIZE 100 /* -- cgit v1.2.1