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

List:       kde-commits
Subject:    KDE/kdegraphics/kviewshell/plugins/dvi
From:       Wilfried Huss <Wilfried.Huss () gmx ! at>
Date:       2006-09-12 9:08:09
Message-ID: 1158052089.367083.29820.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 583404 by whuss:

Port of commit 583400:

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

CCBUG: 133910

 M  +13 -3     dviRenderer.cpp  


--- trunk/KDE/kdegraphics/kviewshell/plugins/dvi/dviRenderer.cpp #583403:583404
@@ -237,7 +237,7 @@
   QRegExp equationExp("equation\\.(.*)");
   QRegExp itemExp("item\\.(.*)");
   QRegExp citeExp("cite\\.(.*)");
-  
+
   // And finally add anchors to the links
   for (i = page->hyperLinkList.begin(); i != page->hyperLinkList.end(); i++)
   {
@@ -293,7 +293,7 @@
       (*i).linkText = i18n("Citation [%1]", citeExp.cap(1));
     }
   }
-  
+
   page->isEmpty = false;
   if (errorMsg.isEmpty() != true) {
     KMessageBox::detailedError(parentWidget,
@@ -550,7 +550,17 @@
     return false;
   }
 
-  QApplication::setOverrideCursor( Qt::WaitCursor );
+  // Check if the file is a valid DVI file.
+  if (!isValidFile(filename))
+  {
+    KMessageBox::sorry( parentWidget,
+                        i18n("<qt>File corruption! KDVI had trouble interpreting the \
file <nobr><strong>%1</strong></nobr>. Most " +                             "likely \
this means that the DVI file is broken.</qt>", fname)); +    return false;
+  }
+
+  QApplication::setOverrideCursor( Qt::waitCursor );
+  
   dvifile *dviFile_new = new dvifile(filename, &font_pool);
 
   if ((dviFile == 0) || (dviFile->filename != filename))


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

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