summaryrefslogtreecommitdiff
path: root/gtk/gtkprintjob.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-10-03 19:24:52 +0200
committerCarlos Garcia Campos <carlosgc@gnome.org>2013-04-14 12:19:09 +0200
commitc737e1d194b9fadfbbcfe6a6ce7bc38c16055ef9 (patch)
tree97378eb441da809175bd43eefe22d6ee16504b74 /gtk/gtkprintjob.c
parent2adacca119aad1c8f62b02028762dc454aee4474 (diff)
downloadgtk+-c737e1d194b9fadfbbcfe6a6ce7bc38c16055ef9.tar.gz
gtkprintjob: release the surface and backend before the output io channel
If the GtkPrintJob is freed too early when the surface has been created but the job hasn't been sent to the printer, it's possible that the file print backend tries to write to the io chaneel when it is already closed. This produces runtime critical warnings: GLib-CRITICAL **: g_io_channel_write_chars: assertion `channel->is_writeable' failed https://bugzilla.gnome.org/show_bug.cgi?id=685420
Diffstat (limited to 'gtk/gtkprintjob.c')
-rw-r--r--gtk/gtkprintjob.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gtk/gtkprintjob.c b/gtk/gtkprintjob.c
index 49c664d88f..439b668626 100644
--- a/gtk/gtkprintjob.c
+++ b/gtk/gtkprintjob.c
@@ -269,21 +269,21 @@ gtk_print_job_finalize (GObject *object)
GtkPrintJob *job = GTK_PRINT_JOB (object);
GtkPrintJobPrivate *priv = job->priv;
+ if (priv->surface)
+ cairo_surface_destroy (priv->surface);
+
+ if (priv->backend)
+ g_object_unref (priv->backend);
+
if (priv->spool_io != NULL)
{
g_io_channel_unref (priv->spool_io);
priv->spool_io = NULL;
}
- if (priv->backend)
- g_object_unref (priv->backend);
-
if (priv->printer)
g_object_unref (priv->printer);
- if (priv->surface)
- cairo_surface_destroy (priv->surface);
-
if (priv->settings)
g_object_unref (priv->settings);