GNOME Bugzilla – Bug 711177
Print to file fails with default settings
Last modified: 2014-03-18 20:51:18 UTC
Print to file fails if no directory is selected. To reproduce: 1. Open Firefox. 2. Press ctrl-p to open the print dialog. 3. Select print to file. The dialog will suggest a name for the file (ie, mozilla.pdf) 4. Click "Print," or press enter. No file is created. filesave_changed_cb is being called and clobbers the filename in the print options. Calling g_build_path ("/", gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (combo)), file, NULL) returns an empty string because the call to gtk_file_chooser_get_uri() returns NULL if a directory has not been set. This reportedly also affects inkscape (see https://bugzilla.novell.com/show_bug.cgi?id=839089 for a downstream bug). Also https://bugzilla.redhat.com/show_bug.cgi?id=1003198 Gtk+ 3 is unaffected as far as I can tell (savefile_changed_cb is no longer present).
Created attachment 258612 [details] [review] Proposed patch.
*** Bug 710746 has been marked as a duplicate of this bug. ***
Review of attachment 258612 [details] [review]: Hi Mike, thank you for the patch. I'll accept it as soon as you add freeing of the chooser_uri to it. Regards Marek ::: gtk/gtkprinteroptionwidget.c @@ +523,3 @@ else + { + const gchar *chooser_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (priv->combo)); You have to free the returned uri with g_free().
*** Bug 696312 has been marked as a duplicate of this bug. ***
Created attachment 272203 [details] [review] Revised patch. Add freeing of the chooser_uri.
Review of attachment 272203 [details] [review]: Thank you for the patch. Push it to gtk-2-24 branch please. Marek
Comment on attachment 272203 [details] [review] Revised patch. Committed to gtk-2-24: 601891