From 6de49223c660b9233b7809e81f826cb99e6ecd5d Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Sun, 19 Jun 2005 20:58:21 +0000 Subject: [PATCH] Some leaks fixed * pdf/ev-poppler.cc: * shell/ev-sidebar-links.c: (job_finished_callback): * shell/ev-view.c: (update_find_status_message): Some leaks fixed --- ChangeLog | 8 ++++++++ pdf/ev-poppler.cc | 27 ++++++++++++++++++++++++--- shell/ev-sidebar-links.c | 5 +++-- shell/ev-view.c | 1 + 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e9d6d53..4548cf82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-06-20 Nickolay V. Shmyrev + + * pdf/ev-poppler.cc: + * shell/ev-sidebar-links.c: (job_finished_callback): + * shell/ev-view.c: (update_find_status_message): + + Some leaks fixed + 2005-06-19 Christian Persch * cut-n-paste/recent-files/egg-recent-view-uimanager.c: diff --git a/pdf/ev-poppler.cc b/pdf/ev-poppler.cc index cfb745d0..8916ae18 100644 --- a/pdf/ev-poppler.cc +++ b/pdf/ev-poppler.cc @@ -189,6 +189,7 @@ get_document_orientation (PdfDocument *pdf_document) } else { return POPPLER_ORIENTATION_PORTRAIT; } + g_object_unref (page); #else return POPPLER_ORIENTATION_PORTRAIT; #endif @@ -240,6 +241,7 @@ pdf_document_get_page_size (EvDocument *document, poppler_page = poppler_document_get_page (pdf_document->document, page); set_page_orientation (pdf_document, poppler_page); poppler_page_get_size (poppler_page, width, height); + g_object_unref (poppler_page); } static char * @@ -255,6 +257,7 @@ pdf_document_get_page_label (EvDocument *document, g_object_get (G_OBJECT (poppler_page), "label", &label, NULL); + g_object_unref (poppler_page); return label; } @@ -293,6 +296,7 @@ pdf_document_get_links (EvDocument *document, } poppler_page_free_link_mapping (mapping_list); + g_object_unref (poppler_page); return g_list_reverse (retval); } @@ -328,7 +332,9 @@ pdf_document_render_pixbuf (EvDocument *document, scale, pixbuf, 0, 0); - + + g_object_unref (poppler_page); + return pixbuf; } @@ -503,6 +509,7 @@ pdf_document_get_text (EvDocument *document, int page, EvRectangle *rect) PopplerPage *poppler_page; PopplerRectangle r; double height; + char *text; poppler_page = poppler_document_get_page (pdf_document->document, page); set_page_orientation (pdf_document, poppler_page); @@ -514,7 +521,11 @@ pdf_document_get_text (EvDocument *document, int page, EvRectangle *rect) r.x2 = rect->x2; r.y2 = height - rect->y1; - return poppler_page_get_text (poppler_page, &r); + text = poppler_page_get_text (poppler_page, &r); + + g_object_unref (poppler_page); + + return text; } static EvOrientation @@ -810,6 +821,7 @@ make_thumbnail_for_size (PdfDocument *pdf_document, scale, pixbuf, x_offset, y_offset); + g_object_unref (poppler_page); return pixbuf; } @@ -830,6 +842,7 @@ pdf_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document_thumbnails g_return_val_if_fail (poppler_page != NULL, NULL); pixbuf = poppler_page_get_thumbnail (poppler_page); + if (pixbuf != NULL) { /* The document provides its own thumbnails. */ if (border) { @@ -843,6 +856,9 @@ pdf_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document_thumbnails /* There is no provided thumbnail. We need to make one. */ pixbuf = make_thumbnail_for_size (pdf_document, page, size, border); } + + g_object_unref (poppler_page); + return pixbuf; } @@ -879,6 +895,7 @@ pdf_document_thumbnails_get_dimensions (EvDocumentThumbnails *document_thumbnail *height = size; } } + g_object_unref (poppler_page); } static void @@ -906,6 +923,8 @@ pdf_document_search_idle_callback (void *data) matches = poppler_page_find_text (page, search->text); ev_document_doc_mutex_unlock (); + g_object_unref (page); + search->pages[search->search_page] = matches; ev_document_find_changed (EV_DOCUMENT_FIND (pdf_document), search->search_page); @@ -1043,7 +1062,8 @@ pdf_document_find_get_result (EvDocumentFind *document_find, rectangle->y1 = height - r->y2; rectangle->x2 = r->x2; rectangle->y2 = height - r->y1; - + g_object_unref (poppler_page); + return TRUE; } @@ -1126,6 +1146,7 @@ pdf_document_ps_exporter_do_page (EvPSExporter *exporter, int page) poppler_page = poppler_document_get_page (pdf_document->document, page); set_page_orientation (pdf_document, poppler_page); poppler_page_render_to_ps (poppler_page, pdf_document->ps_file); + g_object_unref (poppler_page); } static void diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c index 55f2ddb3..58dac08c 100644 --- a/shell/ev-sidebar-links.c +++ b/shell/ev-sidebar-links.c @@ -578,11 +578,12 @@ job_finished_callback (EvJobLinks *job, GtkTreeSelection *selection; priv = sidebar_links->priv; - - priv->model = g_object_ref (job->model); + + priv->model = job->model; g_object_notify (G_OBJECT (sidebar_links), "model"); gtk_tree_view_set_model (GTK_TREE_VIEW (priv->tree_view), job->model); + g_object_unref (job); priv->job = NULL; diff --git a/shell/ev-view.c b/shell/ev-view.c index 5cc6f57d..f9f72069 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -2481,6 +2481,7 @@ update_find_status_message (EvView *view) } ev_view_set_find_status (view, message); + g_free (message); } const char * -- 2.43.5