]> www.fi.muni.cz Git - evince.git/commitdiff
[libview] Unref EvPage as soon as page is rendered
authorCarlos Garcia Campos <carlosgc@gnome.org>
Wed, 9 Dec 2009 17:14:06 +0000 (18:14 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Wed, 9 Dec 2009 17:14:06 +0000 (18:14 +0100)
libview/ev-jobs.c
libview/ev-jobs.h

index d13c06b27abb828268d22082e34b7405a8df1fae..df15f6db865ce0fa489905019abf982b38190b43 100644 (file)
@@ -448,12 +448,8 @@ ev_job_render_dispose (GObject *object)
 
        job = EV_JOB_RENDER (object);
 
-       if (job->ev_page) {
-               ev_debug_message (DEBUG_JOBS, "page: %d (%p)", job->ev_page->index, job);
-               g_object_unref (job->ev_page);
-               job->ev_page = NULL;
-       }
-       
+       ev_debug_message (DEBUG_JOBS, "page: %d (%p)", job->page, job);
+
        if (job->surface) {
                cairo_surface_destroy (job->surface);
                job->surface = NULL;
@@ -476,6 +472,7 @@ static gboolean
 ev_job_render_run (EvJob *job)
 {
        EvJobRender     *job_render = EV_JOB_RENDER (job);
+       EvPage          *ev_page;
        EvRenderContext *rc;
 
        ev_debug_message (DEBUG_JOBS, "page: %d (%p)", job_render->page, job);
@@ -487,9 +484,10 @@ ev_job_render_run (EvJob *job)
                
        ev_document_fc_mutex_lock ();
 
-       job_render->ev_page = ev_document_get_page (job->document, job_render->page);
-       rc = ev_render_context_new (job_render->ev_page, job_render->rotation, job_render->scale);
-               
+       ev_page = ev_document_get_page (job->document, job_render->page);
+       rc = ev_render_context_new (ev_page, job_render->rotation, job_render->scale);
+       g_object_unref (ev_page);
+
        job_render->surface = ev_document_render (job->document, rc);
        /* If job was cancelled during the page rendering,
         * we return now, so that the thread is finished ASAP
index 8777d4c46f8c3912adef4808cbc6cb4db1120792..7be4d4a33a47931ee32638846f31a4fa42f2e454 100644 (file)
@@ -205,7 +205,6 @@ struct _EvJobRender
        gint rotation;
        gdouble scale;
 
-       EvPage *ev_page;
        gboolean page_ready;
        gint target_width;
        gint target_height;