diff --git a/dviwin.cpp b/dviwin.cpp index bd903387c..05e807beb 100644 --- a/dviwin.cpp +++ b/dviwin.cpp @@ -342,10 +342,20 @@ void dviWindow::setFile( const char *fname ) QFileInfo fi(fname); QString filename = fi.absFilePath(); - // Make sure the file actually exists. - if (strlen(fname) == 0) + // If fname is the empty string, then this means: "close". Delete + // the dvifile and the pixmap. + if (strlen(fname) == 0) { + if (dviFile) + delete dviFile; + dviFile = 0; + if (pixmap) + delete pixmap; + pixmap = 0; + resize(0, 0); return; + } + // Make sure the file actually exists. if (!fi.exists() || fi.isDir()) { KMessageBox::error( this, i18n("File error!\n\n") + diff --git a/kdvi_multipage.cpp b/kdvi_multipage.cpp index 13b195df6..0e99c9bf7 100644 --- a/kdvi_multipage.cpp +++ b/kdvi_multipage.cpp @@ -124,11 +124,8 @@ bool KDVIMultiPage::openFile() bool KDVIMultiPage::closeURL() { - window->setFile(""); - scrollView()->resizeContents(0, 0); - + window->setFile(""); // That means: close the file. Resize the widget to 0x0. emit previewChanged(false); - return true; }