summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2014-03-14 15:36:10 +0100
committerMatthias Clasen <mclasen@redhat.com>2014-03-17 14:37:34 -0400
commitb95ce71b89f02a58902f5784ef51fa2e0c49c27f (patch)
tree936254cd6a554a4ac0d3f3505048580097cfbaf4
parent3693045566793cb926d828cf4836a030ec550e1a (diff)
downloadgtk+-b95ce71b89f02a58902f5784ef51fa2e0c49c27f.tar.gz
printing: Fail nicely when /tmp is not writable
Don't crash when /tmp is not writable when printing to file. Show that getting of printer details failed for CUPS printers. https://bugzilla.gnome.org/show_bug.cgi?id=693200
-rw-r--r--gtk/gtkprintjob.c2
-rw-r--r--gtk/gtkprintoperation-unix.c5
-rw-r--r--gtk/gtkprintunixdialog.c2
-rw-r--r--modules/printbackends/cups/gtkprintbackendcups.c2
4 files changed, 6 insertions, 5 deletions
diff --git a/gtk/gtkprintjob.c b/gtk/gtkprintjob.c
index d31b7dc061..05772ad6f2 100644
--- a/gtk/gtkprintjob.c
+++ b/gtk/gtkprintjob.c
@@ -473,7 +473,7 @@ gtk_print_job_get_surface (GtkPrintJob *job,
GError **error)
{
GtkPrintJobPrivate *priv;
- gchar *filename;
+ gchar *filename = NULL;
gdouble width, height;
GtkPaperSize *paper_size;
int fd;
diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c
index ebf2a4d30f..1e17b0f831 100644
--- a/gtk/gtkprintoperation-unix.c
+++ b/gtk/gtkprintoperation-unix.c
@@ -135,8 +135,9 @@ op_unix_free (GtkPrintOperationUnix *op_unix)
{
if (op_unix->job)
{
- g_signal_handler_disconnect (op_unix->job,
- op_unix->job_status_changed_tag);
+ if (op_unix->job_status_changed_tag > 0)
+ g_signal_handler_disconnect (op_unix->job,
+ op_unix->job_status_changed_tag);
g_object_unref (op_unix->job);
}
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 6fd82bf999..4761878b4a 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -2044,12 +2044,12 @@ selected_printer_changed (GtkTreeSelection *selection,
G_CALLBACK (printer_details_acquired), dialog);
/* take the reference */
priv->request_details_printer = printer;
- gtk_printer_request_details (printer);
set_busy_cursor (dialog, TRUE);
gtk_list_store_set (GTK_LIST_STORE (priv->printer_list),
g_object_get_data (G_OBJECT (printer), "gtk-print-tree-iter"),
PRINTER_LIST_COL_STATE, _("Getting printer information…"),
-1);
+ gtk_printer_request_details (printer);
return;
}
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c
index 36e7f0fb78..5716e48b5b 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -3489,7 +3489,7 @@ cups_request_ppd (GtkPrinter *printer)
GtkPrintBackend *print_backend;
GtkPrinterCups *cups_printer;
GtkCupsRequest *request;
- char *ppd_filename;
+ char *ppd_filename = NULL;
gchar *resource;
http_t *http;
GetPPDData *data;