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

List:       kde-commits
Subject:    branches/work/kviewshell-0.7/kviewshell/plugins/dvi
From:       Wilfried Huss <Wilfried.Huss () gmx ! at>
Date:       2006-09-12 8:57:40
Message-ID: 1158051460.067599.28602.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 583400 by whuss:

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

CCBUG: 133910

 M  +14 -4     dviRenderer.cpp  


--- branches/work/kviewshell-0.7/kviewshell/plugins/dvi/dviRenderer.cpp \
#583399:583400 @@ -83,7 +83,7 @@
 #endif
 
   QMutexLocker lock(&mutex);
-  
+
   delete PS_interface;
   delete dviFile;
 }
@@ -267,7 +267,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++)
   {
@@ -323,7 +323,7 @@
       (*i).linkText = i18n("Citation [%1]").arg(citeExp.cap(1));
     }
   }
-  
+
   cairo_surface_destroy(cairoImage);
 
   page->isEmpty = false;
@@ -586,6 +586,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 the \
file <nobr><strong>%1</strong></nobr>. 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);
 
@@ -728,7 +738,7 @@
 
   if (dviFile == 0)
     return Anchor();
-  
+
   // case 1: The reference is a number, which we'll interpret as a
   // page number.
   bool ok;


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

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