Close the http connection after getting the PPD.

2007-01-03  Matthias Clasen  <mclasen@redhat.com>

        * modules/printbackends/cups/gtkprintbackendcups.c: Close
        the http connection after getting the PPD.

 

svn path=/branches/gtk-2-10/; revision=17043
This commit is contained in:
Matthias Clasen
2007-01-04 00:13:19 +00:00
committed by Matthias Clasen
parent 4a2ef11414
commit 19bf71f064
2 changed files with 10 additions and 5 deletions

View File

@@ -1,5 +1,8 @@
2007-01-03 Matthias Clasen <mclasen@redhat.com>
* modules/printbackends/cups/gtkprintbackendcups.c: Close
the http connection after getting the PPD.
* gtk/gtkprinteroptionwidget.c (filesave_changed_cb):
Fix memory leaks.

View File

@@ -1193,6 +1193,7 @@ cups_get_printer_list (GtkPrintBackend *backend)
typedef struct {
GtkPrinterCups *printer;
GIOChannel *ppd_io;
http_t *http;
} GetPPDData;
static void
@@ -1200,7 +1201,7 @@ get_ppd_data_free (GetPPDData *data)
{
GTK_NOTE (PRINTING,
g_print ("CUPS Backend: %s\n", G_STRFUNC));
httpClose (data->http);
g_io_channel_unref (data->ppd_io);
g_object_unref (data->printer);
g_free (data);
@@ -1256,11 +1257,10 @@ cups_request_ppd (GtkPrinter *printer)
GTK_NOTE (PRINTING,
g_print ("CUPS Backend: %s\n", G_STRFUNC));
/* FIXME this can return NULL! */
http = httpConnectEncrypt (cups_printer->hostname,
cups_printer->port,
cupsEncryption ());
data = g_new0 (GetPPDData, 1);
fd = g_file_open_tmp ("gtkprint_ppd_XXXXXX",
@@ -1287,6 +1287,7 @@ cups_request_ppd (GtkPrinter *printer)
return;
}
data->http = http;
fchmod (fd, S_IRUSR | S_IWUSR);
data->ppd_io = g_io_channel_unix_new (fd);
g_io_channel_set_encoding (data->ppd_io, NULL, NULL);
@@ -1295,8 +1296,9 @@ cups_request_ppd (GtkPrinter *printer)
data->printer = g_object_ref (printer);
resource = g_strdup_printf ("/printers/%s.ppd",
gtk_printer_cups_get_ppd_name (GTK_PRINTER_CUPS(printer)));
request = gtk_cups_request_new (http,
gtk_printer_cups_get_ppd_name (GTK_PRINTER_CUPS (printer)));
request = gtk_cups_request_new (data->http,
GTK_CUPS_GET,
0,
data->ppd_io,