changeset 527:3c5570e3d9c5

* Fix crash in SimpleSPARQLQuery * Fix failure to add images from local files
author Chris Cannam
date Thu, 15 Jan 2009 18:20:40 +0000
parents 8878efd21dbc
children 57857a57a03a
files data/fileio/FileSource.cpp rdf/SimpleSPARQLQuery.cpp
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/FileSource.cpp	Fri Jan 09 14:55:12 2009 +0000
+++ b/data/fileio/FileSource.cpp	Thu Jan 15 18:20:40 2009 +0000
@@ -30,7 +30,7 @@
 #include <iostream>
 #include <cstdlib>
 
-//#define DEBUG_FILE_SOURCE 1
+#define DEBUG_FILE_SOURCE 1
 
 int
 FileSource::m_count = 0;
@@ -195,6 +195,10 @@
     m_done = true;
 
 #ifdef DEBUG_FILE_SOURCE
+    std::cerr << "FileSource::FileSource(" << m_url.toString().toStdString() << ") [copy ctor]: note: local filename is \"" << m_localFilename.toStdString() << "\"" << std::endl;
+#endif
+
+#ifdef DEBUG_FILE_SOURCE
     std::cerr << "FileSource::FileSource(copy ctor) exiting" << std::endl;
 #endif
 }
@@ -234,6 +238,9 @@
         m_lastStatus = 200;
 
         if (!QFileInfo(m_localFilename).exists()) {
+#ifdef DEBUG_FILE_SOURCE
+            std::cerr << "FileSource::init: Local file of this name does not exist, trying URL as a literal filename" << std::endl;
+#endif
             if (literal) {
                 m_lastStatus = 404;
             } else {
--- a/rdf/SimpleSPARQLQuery.cpp	Fri Jan 09 14:55:12 2009 +0000
+++ b/rdf/SimpleSPARQLQuery.cpp	Thu Jan 15 18:20:40 2009 +0000
@@ -583,6 +583,10 @@
 
     QMutexLocker locker(&m_mutex);
 
+    if (!m_redland) {
+        m_redland = new WredlandWorldWrapper();
+    }
+
     if (!m_redland->isOK()) {
         std::cerr << "SimpleSPARQLQuery::addSourceToModel: Failed to initialise Redland datastore" << std::endl;
         return false;