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

List:       kde-commits
Subject:    KDE/kdelibs/kded
From:       David Faure <faure () kde ! org>
Date:       2009-12-02 0:02:54
Message-ID: 1259712174.803891.14963.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1057320 by dfaure:

Fix crash when a mimetype was detected (during directory listing) but isn't found \
again by name later on (stat() fails, e.g. because it was removed meanwhile, or \
because the directory doesn't have +x permissions for some still unknown reason). I \
believe the real bug is in update-mime-database. Fixed for: 4.4.0-beta2
CCBUG: 202871


 M  +10 -6     kbuildmimetypefactory.cpp  


--- trunk/KDE/kdelibs/kded/kbuildmimetypefactory.cpp #1057319:1057320
@@ -100,6 +100,11 @@
     QMap<QString, QString> commentsByLanguage;
 
     const QStringList mimeFiles = KGlobal::dirs()->findAllResources(resource, file);
+    if (mimeFiles.isEmpty()) {
+        kWarning() << "No file found for" << file << ", even though the file \
appeared in a directory listing."; +        kWarning() << "Either it was just \
removed, or the directory doesn't have executable permission..."; +        return 0;
+    }
     QListIterator<QString> mimeFilesIter(mimeFiles);
     mimeFilesIter.toBack();
     while (mimeFilesIter.hasPrevious()) { // global first, then local.
@@ -167,7 +172,7 @@
         kWarning() << "Missing <comment> field in" << file;
     }
 
-    //kDebug() << "Creating mimetype" << name << "from file" << file << "path" << \
fullPath; +    //kDebug() << "Creating mimetype" << name << "from file" << file << \
mimeFiles;  
     KMimeType* e;
     if ( name == "inode/directory" )
@@ -347,11 +352,10 @@
     const KMimeFileParser::AllGlobs& allGlobs = m_parser.mimeTypeGlobs();
     Q_FOREACH(const QString& mimeTypeName, m_parser.allMimeTypes()) {
         const KMimeType::Ptr mimeType = findMimeTypeByName(mimeTypeName, \
                KMimeType::DontResolveAlias);
-	if ( ! mimeType )
-	{
-		kFatal() << "MIMETYPE NOT FOUND:" << mimeTypeName ; 
-		continue;
-	}
+        if (!mimeType) {
+            kDebug() << "globs file refers to unknown mimetype" << mimeTypeName;
+            continue;
+        }
         const KMimeFileParser::GlobList globs = allGlobs.value(mimeTypeName);
         Q_FOREACH(const KMimeFileParser::Glob& glob, globs) {
             const QString &pattern = glob.pattern;


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

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