+2006-05-29 Nickolay V. Shmyrev <<nshmyrev@yandex.ru>>
+
+ * shell/ev-jobs.c: (ev_job_xfer_dispose), (ev_job_xfer_new):
+ * shell/ev-jobs.h:
+ * shell/ev-window.c: (ev_window_xfer_job_cb), (ev_window_open_uri),
+ (ev_window_cmd_view_reload), (ev_window_init):
+
+ Don't crash on reload. Fix for the bug #343167.
+
2006-05-28 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
* shell/ev-jobs.c: (ev_job_render_run):
job->error = NULL;
}
+ if (job->dest) {
+ g_object_unref (job->dest);
+ job->dest = NULL;
+ }
+
(* G_OBJECT_CLASS (ev_job_xfer_parent_class)->dispose) (object);
}
EvJob *
-ev_job_xfer_new (const gchar *uri)
+ev_job_xfer_new (const gchar *uri, EvLinkDest *dest)
{
EvJobXfer *job;
job = g_object_new (EV_TYPE_JOB_XFER, NULL);
job->uri = g_strdup (uri);
+ if (dest)
+ job->dest = g_object_ref (dest);
return EV_JOB (job);
}
ev_window_setup_document (ev_window);
ev_window_add_recent (ev_window, ev_window->priv->uri);
- ev_window_clear_xfer_job (ev_window);
- if (ev_window->priv->dest)
- ev_window_goto_dest (ev_window, ev_window->priv->dest);
-
+ if (job->dest)
+ ev_window_goto_dest (ev_window, job->dest);
+
+ ev_window_clear_xfer_job (ev_window);
return;
}
void
ev_window_open_uri (EvWindow *ev_window, const char *uri, EvLinkDest *dest)
{
- g_free (ev_window->priv->uri);
- ev_window->priv->uri = NULL;
-
- if (ev_window->priv->dest)
- g_object_unref (ev_window->priv->dest);
- ev_window->priv->dest = dest ? g_object_ref (dest) : NULL;
-
ev_window_close_dialogs (ev_window);
ev_window_clear_xfer_job (ev_window);
ev_window_clear_local_uri (ev_window);
ev_view_set_loading (EV_VIEW (ev_window->priv->view), TRUE);
- ev_window->priv->xfer_job = ev_job_xfer_new (uri);
+ ev_window->priv->xfer_job = ev_job_xfer_new (uri, dest);
g_signal_connect (ev_window->priv->xfer_job,
"finished",
G_CALLBACK (ev_window_xfer_job_cb),
ev_window_cmd_view_reload (GtkAction *action, EvWindow *ev_window)
{
char *uri;
- int page;
g_return_if_fail (EV_IS_WINDOW (ev_window));
- page = ev_page_cache_get_current_page (ev_window->priv->page_cache);
uri = g_strdup (ev_window->priv->uri);
ev_window_open_uri (ev_window, uri, NULL);
- /* In case the number of pages in the document has changed. */
- page = CLAMP (page, 0, ev_page_cache_get_n_pages (ev_window->priv->page_cache) - 1);
-
- ev_page_cache_set_current_page (ev_window->priv->page_cache, page);
-
g_free (uri);
}
ev_window->priv = EV_WINDOW_GET_PRIVATE (ev_window);
- ev_window->priv->dest = NULL;
-
ev_window->priv->page_mode = PAGE_MODE_DOCUMENT;
ev_window->priv->title = ev_window_title_new (ev_window);