summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Sullivan <sullivan@src.gnome.org>2001-02-06 06:32:06 +0000
committerJohn Sullivan <sullivan@src.gnome.org>2001-02-06 06:32:06 +0000
commit6dc4263c5f261c9f096cf8392a83afe0680fb771 (patch)
treefdf7ae409bcad3df26ba5f6380fbbe7703d124d2
parentca6019ecc662e94b21c77004e3e8a68da6b1e3f4 (diff)
downloadnautilus-6dc4263c5f261c9f096cf8392a83afe0680fb771.tar.gz
Fixed bug 6359 (Choosing current view from "View as" menu crashes)
* src/nautilus-window-manage-views.c: (nautilus_window_content_view_matches_iid): New function, extracted from load_content_view, checks whether passed iid is the one in use by this window. (load_content_view): Now calls extracted function. (nautilus_window_set_content_view): Bail out early if the new content view is the old one. This avoids unpleasant crashing later on.
-rw-r--r--ChangeLog13
-rw-r--r--src/nautilus-window-manage-views.c29
2 files changed, 34 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 7b7cdbb86..fbde0a119 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2001-02-05 John Sullivan <sullivan@eazel.com>
+
+ Fixed bug 6359 (Choosing current view from "View as" menu crashes)
+
+ * src/nautilus-window-manage-views.c:
+ (nautilus_window_content_view_matches_iid): New function, extracted
+ from load_content_view, checks whether passed iid is the one in
+ use by this window.
+ (load_content_view): Now calls extracted function.
+ (nautilus_window_set_content_view): Bail out early if the
+ new content view is the old one. This avoids unpleasant crashing
+ later on.
+
2001-02-05 Gene Z. Ragan <gzr@eazel.com>
Add code to send the mime type of the file being examined to the
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index f1fe28fd4..449922728 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -876,11 +876,26 @@ set_to_pending_location_and_selection (NautilusWindow *window)
window->details->pending_selection = NULL;
}
+static gboolean
+nautilus_window_content_view_matches_iid (NautilusWindow *window,
+ const char *iid)
+{
+ const char *content_view_iid;
+
+ if (window->content_view == NULL) {
+ content_view_iid = "";
+ } else {
+ content_view_iid = nautilus_view_frame_get_view_iid (window->content_view);
+ }
+
+ return strcmp (content_view_iid, iid) == 0;
+}
+
static void
load_content_view (NautilusWindow *window,
const NautilusViewIdentifier *id)
{
- const char *iid, *content_view_iid;
+ const char *iid;
NautilusViewFrame *view;
/* FIXME bugzilla.eazel.com 1243:
@@ -914,13 +929,7 @@ load_content_view (NautilusWindow *window,
nautilus_view_identifier_free (window->content_view_id);
window->content_view_id = nautilus_view_identifier_copy (id);
- if (window->content_view == NULL) {
- content_view_iid = "";
- } else {
- content_view_iid = nautilus_view_frame_get_view_iid (window->content_view);
- }
-
- if (strcmp (content_view_iid, iid) == 0) {
+ if (nautilus_window_content_view_matches_iid (window, iid)) {
/* reuse existing content view */
view = window->content_view;
window->new_content_view = view;
@@ -1371,6 +1380,10 @@ nautilus_window_set_content_view (NautilusWindow *window,
g_return_if_fail (window->new_content_view == NULL);
g_return_if_fail (id != NULL);
+ if (nautilus_window_content_view_matches_iid (window, id->iid)) {
+ return;
+ }
+
file = nautilus_file_get (window->details->location);
nautilus_mime_set_default_component_for_file
(file, id->iid);