[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/runtime/nepomuk/strigibackend
From: Frederik Gladhorn <gladhorn () kde ! org>
Date: 2009-11-06 11:35:56
Message-ID: 1257507356.943912.27515.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1045618 by gladhorn:
Fix crash when strigi analyzers go into embedded files (depth>0) by using a stack for \
AnalysisResult*
M +10 -19 sopranoindexwriter.cpp
--- trunk/KDE/kdebase/runtime/nepomuk/strigibackend/sopranoindexwriter.cpp \
#1045617:1045618 @@ -40,6 +40,7 @@
#include <QtCore/QDateTime>
#include <QtCore/QByteArray>
#include <QtCore/QUuid>
+#include <QtCore/QStack>
#include <KUrl>
#include <KDebug>
@@ -150,8 +151,8 @@
{
public:
Private()
- : indexTransactionID( 0 ),
- currentResult( 0 ) {
+ : indexTransactionID( 0 )
+ {
literalTypes[FieldRegister::stringType] = QVariant::String;
literalTypes[FieldRegister::floatType] = QVariant::Double;
literalTypes[FieldRegister::integerType] = QVariant::Int;
@@ -226,7 +227,8 @@
// However, we only use one thread, only one AnalysisResult at the time.
// Thus, we can just remember that and use it in addTriplet.
//
- const Strigi::AnalysisResult* currentResult;
+
+ QStack<const Strigi::AnalysisResult*> currentResultStack;
private:
QHash<std::string, QVariant::Type> literalTypes;
@@ -325,6 +327,8 @@
// called for each indexed file
void Strigi::Soprano::IndexWriter::startAnalysis( const AnalysisResult* idx )
{
+ d->currentResultStack.push(idx);
+
if ( idx->depth() > 0 ) {
return;
}
@@ -345,7 +349,6 @@
idx->setWriterData( data );
- d->currentResult = idx;
}
@@ -497,23 +500,11 @@
const std::string& p,
const std::string& o )
{
- //
- // The Strigi API does not provide context information here, i.e. the \
AnalysisResult this triple
- // belongs to. However, we only use one thread, only one AnalysisResult at the \
time.
- // Thus, we can just remember that and use it here.
- //
-
- // mjansen: 08/2009 - I get many crashes here and can't print s, p and o
- // from the debugger with the core files. So print out this information
- // and then die.
- if (!d->currentResult) {
- kWarning() << "Attempt to add" << s.c_str() << p.c_str() << o.c_str() << "to \
IndexWriter with currentResult = NULL";
- Q_ASSERT(d->currentResult);
- // In production just return.
+ if ( d->currentResultStack.top()->depth() > 0 ) {
return;
}
- FileMetaData* md = static_cast<FileMetaData*>( d->currentResult->writerData() );
+ FileMetaData* md = static_cast<FileMetaData*>( \
d->currentResultStack.top()->writerData() );
QUrl subject = d->mapNode( md, s );
Nepomuk::Types::Property property( d->mapNode( md, p ) );
@@ -530,7 +521,7 @@
// called after each indexed file
void Strigi::Soprano::IndexWriter::finishAnalysis( const AnalysisResult* idx )
{
- d->currentResult = 0;
+ d->currentResultStack.pop();
if ( idx->depth() > 0 ) {
return;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic