[bug #312803] crash on print to file



Hi,

I get a crash many times when I print to file in Epiphany. It's caused
by a combination of buggy mozilla, and a bug in gnome-print's file
transport [http://bugzilla.gnome.org/show_bug.cgi?id=312803], which the
attached patch fixes. Can someone please review the patch and check it
in?

Thanks,
	Christian
Index: libgnomeprint/gnome-print-transport.c
===================================================================
RCS file: /cvs/gnome/libgnomeprint/libgnomeprint/gnome-print-transport.c,v
retrieving revision 1.26
diff -p -u -u -p -U23 -r1.26 gnome-print-transport.c
--- libgnomeprint/gnome-print-transport.c	25 Mar 2005 19:14:50 -0000	1.26
+++ libgnomeprint/gnome-print-transport.c	28 Aug 2005 10:38:17 -0000
@@ -357,49 +357,50 @@ gnome_print_transport_new (GnomePrintCon
 
 static gint
 gnome_print_transport_real_print_file (GnomePrintTransport *transport, const guchar *file_name)
 {
 	FILE *input;
 	char buffer[1024];
 	int retval;
 
 	input = fopen (file_name, "rb");
 
 	if (input) {
 		int count;
 
 		gnome_print_transport_open (transport);
 
 		while ((count = fread (buffer, 1, BLOCK_SIZE, input))) {
 			retval = gnome_print_transport_write (transport, buffer, count);
 
 			if (retval != count) {
 				fclose(input);
 				return retval;
 			}
 		}
+
+		fclose(input);
 	}
 
-	fclose(input);
 	retval = gnome_print_transport_close (transport);
 	
 	return retval;
 }
 
 /**
  * gnome_print_transport_exists_by_name :
  * @name : 
  *
  * NEW Since 2.8.2
  *
  * Returns TRUE if the transport @name is valid on the system.
  **/
 gboolean
 gnome_print_transport_exists_by_name (const char *name)
 {
 	GnomePrintTransport *trans;
 
 	g_return_val_if_fail (name != NULL, FALSE);
 
 	trans = gnome_print_transport_new_from_module_name (name, NULL);
 	if (trans != NULL) {
 		g_object_unref (trans);


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