[gnumeric] Print/GUI: leak fix.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Print/GUI: leak fix.
- Date: Mon, 21 Nov 2011 15:57:18 +0000 (UTC)
commit fac811be49241a22d23b68d449d1c84a3b2951ce
Author: Morten Welinder <terra gnome org>
Date: Mon Nov 21 10:54:56 2011 -0500
Print/GUI: leak fix.
ChangeLog | 7 +++++++
src/print.c | 19 ++++++++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 441ccde..2cb82bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-11-21 Morten Welinder <terra gnome org>
+
+ * src/print.c (gnm_print_sheet): Call gnm_end_print_cb in response
+ to cancel.
+ (gnm_end_print_cb): Ensure this can be called multiple times.
+ Fixes #664447.
+
2011-11-21 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/print.c (gnm_end_print_cb): do not free the printing instance
diff --git a/src/print.c b/src/print.c
index 9812a95..f0009c4 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1330,11 +1330,15 @@ gnm_begin_print_cb (GtkPrintOperation *operation,
}
static void
-gnm_end_print_cb (G_GNUC_UNUSED GtkPrintOperation *operation,
+gnm_end_print_cb (GtkPrintOperation *operation,
G_GNUC_UNUSED GtkPrintContext *context,
G_GNUC_UNUSED gpointer user_data)
{
- /* PrintingInstance * pi = (PrintingInstance *) user_data; */
+ /*
+ * There's confusion as to when this is called, so this function
+ * must allow for multiple calls.
+ */
+ g_object_set_data (G_OBJECT (operation), "pi", NULL);
}
static void
@@ -1756,6 +1760,9 @@ gnm_print_sheet (WorkbookControl *wbc, Sheet *sheet,
pi->wbc = wbc ? WORKBOOK_CONTROL (wbc) : NULL;
pi->sheet = sheet;
pi->preview = preview;
+ g_object_set_data_full (G_OBJECT (print),
+ "pi", pi,
+ (GDestroyNotify)printing_instance_delete);
settings = gnm_conf_get_print_settings ();
if (default_range == PRINT_SAVED_INFO) {
@@ -1804,7 +1811,7 @@ gnm_print_sheet (WorkbookControl *wbc, Sheet *sheet,
g_signal_connect (print, "begin-print", G_CALLBACK (gnm_begin_print_cb), pi);
g_signal_connect (print, "paginate", G_CALLBACK (gnm_paginate_cb), pi);
g_signal_connect (print, "draw-page", G_CALLBACK (gnm_draw_page_cb), pi);
- g_signal_connect (print, "end-print", G_CALLBACK (gnm_end_print_cb), pi);
+ g_signal_connect (print, "end-print", G_CALLBACK (gnm_end_print_cb), NULL);
g_signal_connect (print, "request-page-setup", G_CALLBACK (gnm_request_page_setup_cb), pi);
gtk_print_operation_set_use_full_page (print, FALSE);
@@ -1871,6 +1878,12 @@ gnm_print_sheet (WorkbookControl *wbc, Sheet *sheet,
(sheet->print_info, settings);
break;
case GTK_PRINT_OPERATION_RESULT_CANCEL:
+ /*
+ * There seems to be confusion as to whether gtk will
+ * call this.
+ */
+ gnm_end_print_cb (print, NULL, NULL);
+ break;
case GTK_PRINT_OPERATION_RESULT_ERROR:
break;
case GTK_PRINT_OPERATION_RESULT_IN_PROGRESS:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]