[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdegraphics/kdvi
From:       Wilfried Huss <Wilfried.Huss () gmx ! at>
Date:       2006-09-12 9:03:10
Message-ID: 1158051790.809955.29357.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 583403 by whuss:

Backport of commit 583400:

Don't crash when trying to open a DVI file that has been only partially written.

CCBUG: 133910

 M  +13 -2     dviRenderer.cpp  


--- branches/KDE/3.5/kdegraphics/kdvi/dviRenderer.cpp #583402:583403
@@ -194,7 +194,7 @@
   // Reset colors
   colorStack.clear();
   globalColor = Qt::black;
-  
+
   QApplication::setOverrideCursor( waitCursor );
   foreGroundPainter = page->getPainter();
   if (foreGroundPainter != 0) {
@@ -203,6 +203,7 @@
     page->returnPainter(foreGroundPainter);
   }
   QApplication::restoreOverrideCursor();
+  
   page->isEmpty = false;
   if (errorMsg.isEmpty() != true) {
     KMessageBox::detailedError(parentWidget,
@@ -455,6 +456,16 @@
     return false;
   }
   
+  // Check if the file is a valid DVI file.
+  if (!isValidFile(filename))
+  {
+    KMessageBox::sorry( parentWidget,
+                        i18n("<qt>File corruption! KDVI had trouble interpreting your DVI file. Most "
+                             "likely this means that the DVI file is broken.</qt>")
+                        .arg( fname ) );
+    return false;
+  }
+
   QApplication::setOverrideCursor( waitCursor );
   dvifile *dviFile_new = new dvifile(filename, &font_pool);
   
@@ -594,7 +605,7 @@
 #ifdef DEBUG_DVIRENDERER
   kdError(4300) << "dviRenderer::parseReference( " << reference << " ) called" << endl;
 #endif
-  
+
   if (dviFile == 0) {
     mutex.unlock();
     return Anchor();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic