From 09ea880a43093d3d8e11344b0aa338667cafb50f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 12 May 2020 14:09:51 -0400 Subject: [PATCH] printoperation-unix: Fix a use-after-free It turns out that finish_print destroys the PrintResponseData, so we can't access it afterwards. --- gtk/gtkprintoperation-unix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c index f6b2195e17..87d97e240e 100644 --- a/gtk/gtkprintoperation-unix.c +++ b/gtk/gtkprintoperation-unix.c @@ -650,6 +650,9 @@ handle_print_response (GtkWidget *dialog, gtk_print_operation_set_print_settings (rdata->op, settings); g_signal_emit_by_name (rdata->op, "custom-widget-apply", rdata->op->priv->custom_widget); } + + if (rdata->loop) + g_main_loop_quit (rdata->loop); finish_print (rdata, printer, page_setup, settings, page_setup_set); @@ -657,9 +660,6 @@ handle_print_response (GtkWidget *dialog, g_object_unref (settings); gtk_window_destroy (GTK_WINDOW (pd)); - - if (rdata->loop) - g_main_loop_quit (rdata->loop); }