[evince] [libview] Unref EvPage as soon as page is rendered



commit e3c697ada15e7e5ffd47562350bdfee455b29322
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Wed Dec 9 18:14:06 2009 +0100

    [libview] Unref EvPage as soon as page is rendered

 libview/ev-jobs.c |   16 +++++++---------
 libview/ev-jobs.h |    1 -
 2 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c
index d13c06b..df15f6d 100644
--- a/libview/ev-jobs.c
+++ b/libview/ev-jobs.c
@@ -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
diff --git a/libview/ev-jobs.h b/libview/ev-jobs.h
index 8777d4c..7be4d4a 100644
--- a/libview/ev-jobs.h
+++ b/libview/ev-jobs.h
@@ -205,7 +205,6 @@ struct _EvJobRender
 	gint rotation;
 	gdouble scale;
 
-	EvPage *ev_page;
 	gboolean page_ready;
 	gint target_width;
 	gint target_height;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]