]> www.fi.muni.cz Git - evince.git/commitdiff
Don't crash on reload. Fix for the bug #343167.
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Mon, 29 May 2006 15:35:29 +0000 (15:35 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Mon, 29 May 2006 15:35:29 +0000 (15:35 +0000)
* 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.

ChangeLog
shell/ev-jobs.c
shell/ev-jobs.h
shell/ev-window.c

index 0ecadfc5853c9d9886b80323b600d74cab8e3935..8b019ec0d105dcec564c7ad83818c58397f26ef7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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):
index 8bd3d45290deaceccfd07fcf2ec16db0d94ad449..e9f29eb681949ede515e4cf9688bfd1a64d80716 100644 (file)
@@ -389,6 +389,11 @@ ev_job_xfer_dispose (GObject *object)
                job->error = NULL;
        }
 
+       if (job->dest) {
+               g_object_unref (job->dest);
+               job->dest = NULL;
+       }
+
        (* G_OBJECT_CLASS (ev_job_xfer_parent_class)->dispose) (object);
 }
 
@@ -404,13 +409,15 @@ ev_job_xfer_class_init (EvJobXferClass *class)
 
 
 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);
 }
index a7f6e8255cb861690ce86909d715b6ce87cc04a7..bf9c86b6f6c963d89ccec2ec9cf66d9835b6f88b 100644 (file)
@@ -162,6 +162,7 @@ struct _EvJobFontsClass
 struct _EvJobXfer
 {
        EvJob parent;
+       EvLinkDest *dest;
        GError *error;
        char *uri;
        char *local_uri;
@@ -210,7 +211,7 @@ void                ev_job_fonts_run          (EvJobFonts      *fonts);
 
 /* EvJobXfer */
 GType          ev_job_xfer_get_type      (void);
-EvJob         *ev_job_xfer_new           (const gchar     *uri);
+EvJob         *ev_job_xfer_new           (const gchar     *uri, EvLinkDest *dest);
 void           ev_job_xfer_run           (EvJobXfer       *xfer);                                         
 
 G_END_DECLS
index 8a6cf43ee40a4d4203f0b2d79276d09bc5553c7c..e4b0ca0ca96cacc2876e8539d3c934298e715767 100644 (file)
@@ -930,11 +930,11 @@ ev_window_xfer_job_cb  (EvJobXfer *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;
        }
 
@@ -997,19 +997,12 @@ ev_window_close_dialogs (EvWindow *ev_window)
 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),
@@ -2072,20 +2065,13 @@ static void
 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);
 }
 
@@ -3464,8 +3450,6 @@ ev_window_init (EvWindow *ev_window)
 
        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);