Bug 261785 - premature file deletion when viewing font file
Summary: premature file deletion when viewing font file
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: general (show other bugs)
Version: 2.15
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Raphael Kubo da Costa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-01 15:03 UTC by Martin Koller
Modified: 2011-01-01 22:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.5.5


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Koller 2011-01-01 15:03:51 UTC
Version:           0.0.1 (using KDE 4.5.90) 
OS:                Linux

When you download a zip file containing a font (e.g. a TTF file, e.g. from http://www.1001freefonts.com/font/BaroqueScript.zip )
and you double click on the font file, then the KDE font viewer is opened and this has a button "Install...".
When I click it, I get an error dialog telling me e.g.:
file:///tmp/kde-koller/arkV2TvUd/BaroqueScript.ttf is not a font
and the reason is: the given file no longer exists.

So it seems ark is deleting the temporary file immediately after starting the viewer, which is too early.

Reproducible: Always




OS: Linux (i686) release 2.6.34.7-0.5-desktop
Compiler: gcc
openSuse 11.3
Comment 1 Raphael Kubo da Costa 2011-01-01 21:54:41 UTC
Indeed, after the changes done to fix bug 216601 and your own bug 226123 Ark is deleting the previewed files too prematurely, as QDialog::exec() is not called anymore.

Thanks for noticing.
Comment 2 Raphael Kubo da Costa 2011-01-01 22:50:46 UTC
SVN commit 1210723 by rkcosta:

Remove the temporarily extracted previewed file correctly.

After r1067160, the QDialog::exec() call in ArkViewer was replaced by
a call to QDialog::show().

This, in turn, made the call to KIO::NetAccess::del() be reached
before the dialog was closed.

We now manually remove the previewed file in all possible places in
ArkViewer::view() with QFile::remove(), and call KRun::runUrl() with
tempFile=true so that kioexec also takes care of removing the
previewed file if that's the case.

Finally, when ArkViewer::dialogClosed() is reached, it also tries to
remove the file (this is the expected code path).

Unfortunately, the code got uglier, so in the future we should try to
centralize the calls to QFile::remove() in a single place.

BUG: 261785
FIXED-IN: 4.5.5

 M  +20 -6     arkviewer.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1210723
Comment 3 Raphael Kubo da Costa 2011-01-01 22:54:52 UTC
SVN commit 1210725 by rkcosta:

Remove the temporarily extracted previewed file correctly.

After r1067160, the QDialog::exec() call in ArkViewer was replaced by
a call to QDialog::show().

This, in turn, made the call to KIO::NetAccess::del() be reached
before the dialog was closed.

We now manually remove the previewed file in all possible places in
ArkViewer::view() with QFile::remove(), and call KRun::runUrl() with
tempFile=true so that kioexec also takes care of removing the
previewed file if that's the case.

Finally, when ArkViewer::dialogClosed() is reached, it also tries to
remove the file (this is the expected code path).

Unfortunately, the code got uglier, so in the future we should try to
centralize the calls to QFile::remove() in a single place.

Forwardport of r1210723.

CCBUG: 261785



 M  +20 -6     arkviewer.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1210725
Comment 4 Raphael Kubo da Costa 2011-01-01 22:55:46 UTC
SVN commit 1210726 by rkcosta:

Remove the temporarily extracted previewed file correctly.

After r1067160, the QDialog::exec() call in ArkViewer was replaced by
a call to QDialog::show().

This, in turn, made the call to KIO::NetAccess::del() be reached
before the dialog was closed.

We now manually remove the previewed file in all possible places in
ArkViewer::view() with QFile::remove(), and call KRun::runUrl() with
tempFile=true so that kioexec also takes care of removing the
previewed file if that's the case.

Finally, when ArkViewer::dialogClosed() is reached, it also tries to
remove the file (this is the expected code path).

Unfortunately, the code got uglier, so in the future we should try to
centralize the calls to QFile::remove() in a single place.

Forwardport of r1210723.

CCBUG: 261785

 M  +20 -6     arkviewer.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1210726