[gtk+] print-operation: Be more robust in the error path



commit 2407f157c76c6835cd0fdc23fdd09875a63c202e
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Mar 16 02:18:24 2016 +0100

    print-operation: Be more robust in the error path
    
    This isn't an issue at the moment. Only exporting to a file can fail
    by setting by setting an error and it happens to correctly return
    GTK_PRINT_OPERATION_RESULT_ERROR regardless of this code.
    
    Still, let's make this block of code more correct to prevent future
    changes from introducing broken behaviour.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763731

 gtk/gtkprintoperation.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c
index 9f4540b..db53d05 100644
--- a/gtk/gtkprintoperation.c
+++ b/gtk/gtkprintoperation.c
@@ -3283,9 +3283,10 @@ gtk_print_operation_run (GtkPrintOperation        *op,
   if (run_print_pages)
     print_pages (op, parent, do_print, result);
 
-  if (priv->error && error)
+  if (priv->error)
     {
-      *error = g_error_copy (priv->error);
+      if (error)
+        *error = g_error_copy (priv->error);
       result = GTK_PRINT_OPERATION_RESULT_ERROR;
     }
   else if (priv->cancelled)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]