mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
Fix some issues with reference handling in the printing code. (#429902,
2007-04-29 Matthias Clasen <mclasen@redhat.com> Fix some issues with reference handling in the printing code. (#429902, Mathias Hasselmann) * gtk/gtkprintoperation.c (gtk_print_operation_finalize): Unref the print context, if we have one. (gtk_print_operation_done): Add a default ::done handler that unrefs the print context. (preview_ready): Take a reference on the print operation preview here. (print_pages_idle): ...not here, (preview_print_idle_done): ...and release it here. * tests/print-editor.c (preview_cb): Take a reference on the print operation here. svn path=/trunk/; revision=17722
This commit is contained in:
parent
7f95ef5ef3
commit
a788ef97a4
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
||||
2007-04-29 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
Fix some issues with reference handling in the printing
|
||||
code. (#429902, Mathias Hasselmann)
|
||||
|
||||
* gtk/gtkprintoperation.c (gtk_print_operation_finalize):
|
||||
Unref the print context, if we have one.
|
||||
(gtk_print_operation_done): Add a default ::done handler
|
||||
that unrefs the print context.
|
||||
(preview_ready): Take a reference on the print operation
|
||||
preview here.
|
||||
(print_pages_idle): ...not here,
|
||||
(preview_print_idle_done): ...and release it here.
|
||||
|
||||
* tests/print-editor.c (preview_cb): Take a reference
|
||||
on the print operation here.
|
||||
|
||||
2007-04-29 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkprintoperation.c (print_pages_idle): Don't get
|
||||
|
@ -120,6 +120,9 @@ gtk_print_operation_finalize (GObject *object)
|
||||
if (priv->print_settings)
|
||||
g_object_unref (priv->print_settings);
|
||||
|
||||
if (priv->print_context)
|
||||
g_object_unref (priv->print_context);
|
||||
|
||||
g_free (priv->export_filename);
|
||||
g_free (priv->job_name);
|
||||
g_free (priv->custom_tab_label);
|
||||
@ -396,6 +399,8 @@ preview_print_idle_done (gpointer data)
|
||||
g_free (pop->filename);
|
||||
|
||||
gtk_print_operation_preview_end_preview (pop->preview);
|
||||
|
||||
g_object_unref (op);
|
||||
g_free (pop);
|
||||
}
|
||||
|
||||
@ -447,6 +452,8 @@ preview_ready (GtkPrintOperationPreview *preview,
|
||||
pop->page_nr = 0;
|
||||
pop->print_context = context;
|
||||
|
||||
g_object_ref (preview);
|
||||
|
||||
gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE + 10,
|
||||
preview_print_idle,
|
||||
pop,
|
||||
@ -495,6 +502,18 @@ gtk_print_operation_create_custom_widget (GtkPrintOperation *operation)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_print_operation_done (GtkPrintOperation *operation)
|
||||
{
|
||||
GtkPrintOperationPrivate *priv = operation->priv;
|
||||
|
||||
if (priv->print_context)
|
||||
{
|
||||
g_object_unref (priv->print_context);
|
||||
priv->print_context = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
custom_widget_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
@ -523,6 +542,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class)
|
||||
|
||||
class->preview = gtk_print_operation_preview_handler;
|
||||
class->create_custom_widget = gtk_print_operation_create_custom_widget;
|
||||
class->done = gtk_print_operation_done;
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkPrintOperationPrivate));
|
||||
|
||||
@ -1935,7 +1955,6 @@ print_pages_idle_done (gpointer user_data)
|
||||
GTK_PRINT_OPERATION_RESULT_APPLY);
|
||||
|
||||
g_object_unref (data->op);
|
||||
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
@ -2129,8 +2148,6 @@ print_pages_idle (gpointer user_data)
|
||||
{
|
||||
done = TRUE;
|
||||
|
||||
g_object_ref (data->op);
|
||||
|
||||
g_signal_emit_by_name (data->op, "ready", priv->print_context);
|
||||
goto out;
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ preview_cb (GtkPrintOperation *op,
|
||||
gtk_print_context_set_cairo_context (context, cr, 72, 72);
|
||||
cairo_destroy (cr);
|
||||
|
||||
pop->op = op;
|
||||
pop->op = g_object_ref (op);
|
||||
pop->preview = preview;
|
||||
pop->spin = page;
|
||||
pop->area = da;
|
||||
|
Loading…
Reference in New Issue
Block a user