diff data/fileio/FileSource.cpp @ 461:2019d89ebcf9

* Some work on querying and cacheing plugin RDF from a central index
author Chris Cannam
date Fri, 17 Oct 2008 15:26:29 +0000
parents 93fb1ebff76b
children 70b333085952
line wrap: on
line diff
--- a/data/fileio/FileSource.cpp	Fri Oct 17 13:32:55 2008 +0000
+++ b/data/fileio/FileSource.cpp	Fri Oct 17 15:26:29 2008 +0000
@@ -421,6 +421,10 @@
 void
 FileSource::cleanup()
 {
+    if (m_done) {
+        delete m_localFile; // does not actually delete the file
+        m_localFile = 0;
+    }
     m_done = true;
     if (m_http) {
         QHttp *h = m_http;
@@ -434,8 +438,10 @@
         f->abort();
         f->deleteLater();
     }
-    delete m_localFile; // does not actually delete the file
-    m_localFile = 0;
+    if (m_localFile) {
+        delete m_localFile; // does not actually delete the file
+        m_localFile = 0;
+    }
 }
 
 bool
@@ -660,7 +666,8 @@
 
     if (error) {
 #ifdef DEBUG_FILE_SOURCE
-        std::cerr << "FileSource::done: error is " << error << ", deleting cache file" << std::endl;
+        std::cerr << "FileSource::done: error is " << error << " (\"" 
+                  << m_errorString.toStdString() << "\"), deleting cache file" << std::endl;
 #endif
         deleteCacheFile();
     }
@@ -756,7 +763,7 @@
     QString filename =
         QString::fromLocal8Bit
         (QCryptographicHash::hash(url.toString().toLocal8Bit(),
-                                  QCryptographicHash::Sha1).toBase64());
+                                  QCryptographicHash::Sha1).toHex());
 
     return dir.filePath(filename);
 }