GNOME Bugzilla – Bug 365282
temp pdf file created by gtkprintoperation-unix is not removed
Last modified: 2007-02-23 01:24:44 UTC
Please describe the problem: gtkprintoperation-unix uses evince to provide the preview capability. However, the temp file generated by gtkprintoperation is not being cleaned out even after the application exits. Steps to reproduce: 1. start gtk-demo 2. launch Printing 3. Click on Preview check out the temp file previewXXXXXX.pdf in iether /tmp/ or /var/tmp 4. exit gtk-demo temp file is not reoved Actual results: Expected results: Does this happen every time? Other information: temp file is created in the function, _gtk_print_operation_platform_backend_create_preview_surface() in gtkprintoperation-unix.c
/** * GtkSettings:gtk-print-preview-command: * * A command to run for displaying the print preview. The command * should contain a %f placeholder, which will get replaced by * the path to the pdf file. * * The preview application is responsible for removing the pdf file * when it is done. * * Since: 2.10 */ So I'd say this is a bug in evince.
I couldn't see what evince can do about this file, since the file is created in gtkprintoperation-unix., evince is spawned as evince --preview %f. Evince can't simply remove all file it is asked to opened unless it provides an option to do so, like evince --preview-unlink %f So, it got to be that the gtkprintoperation should take note of the filename it created and at its termination, remove that file. Just my understanding of this :)
(In reply to comment #2) > I couldn't see what evince can do about this file, since the file is created in > gtkprintoperation-unix., evince is spawned as evince --preview %f. > Evince can't simply remove all file it is asked to opened unless it provides an > option to do so, like evince --preview-unlink %f > > So, it got to be that the gtkprintoperation should take note of the filename it > created and at its termination, remove that file. This doesn't work either. "Single-instance" applications like Evince may return instantly and let the running process open the file. > Just my understanding of this :)
evince --preview is specifically the special mode for gtk print preview, so it should follow the contract and remove the file when it's done. I don't see any problem with that.
(In reply to comment #4) > evince --preview is specifically the special mode for gtk print preview, so it > should follow the contract and remove the file when it's done. I don't see any > problem with that. That would be surprising though for anyone else wanting to use evince --preview. Something like --priview-and-unlink works.
I don't see the problem, since evince --preview was added specifically for print preview mode in gtk, but I'll let evince maints decide. Re-assigning.
Yes, evince --preview was implemented specifically for gtk, but it doesn't mean that preview mode will be used only by gtk. As Behdad said, anyone could want to run evince --preview with an important pdf. Maybe something like --preview --unlink-tempfile would solve the problem.
Isn't just a --unlink-tempfile is hwat requires of for gtk+ preview? Is there something special between a evince --preview and evince <file>.pdf?
(In reply to comment #8) > Is there something special between a evince --preview and evince <file>.pdf? I think it uses a different interface (no menus, ...?) in preview mode.
so we need evince --preview --unlink-tempfile=<filename> after all for gtk+
--unlink-tempfile can be boolean, we already know the file uri. Ok, so I'll implement it then.
THANKS Carlos. I have logged http://bugzilla.gnome.org/show_bug.cgi?id=370041 to track the other changes required on gtk+ side. Though, that change will have to wait until your change is released, otherwise gtk+ preview will not work, see evince --unlink-tempfile --preview /Desktop/guadec2006-printing.pdf Unknown option --unlink-tempfile Run 'evince --help' to see a full list of available command line options.
*** Bug 371975 has been marked as a duplicate of this bug. ***
I've just committed a fix. Some things: - The command line option is hidden since it's thought to be used only by applications, not by users. - We'll only remove the file if it's under g_get_tmp_dir () - The option will only be used in preview mode We have to be sure we don't delete any file we don't really want to delete.
Carlos Rocks :)
*** Bug 396479 has been marked as a duplicate of this bug. ***
*** Bug 408578 has been marked as a duplicate of this bug. ***