[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/nepomuk/core
From: Vishesh Handa <handa.vish () gmail ! com>
Date: 2010-12-08 22:18:05
Message-ID: 20101208221805.EEBE7AC8A5 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1204735 by vhanda:
Fix the Memory leaks in Nepomuk Core -
* ResourceData::updateKickOffLists shouldn't be given a Soprano::Node::uri() as the \
node might not have a uri ( in the case of a Resource ) It's better to pass it a \
Nepomuk::Variant and let it get the type from there.
* ResourceManager::cleanUpCache() should also clear the m_initializedData. This is \
required in the rare case when all the kickOffProperties are removed.
M +12 -5 resourcedata.cpp
M +1 -1 resourcedata.h
M +2 -1 resourcemanager.cpp
--- trunk/KDE/kdelibs/nepomuk/core/resourcedata.cpp #1204734:1204735
@@ -1,6 +1,7 @@
/*
* This file is part of the Nepomuk KDE project.
* Copyright (C) 2006-2010 Sebastian Trueg <trueg@kde.org>
+ * Copyright (C) 2010 Vishesh Handa <handa.vish@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -383,8 +384,9 @@
}
}
else {
- updateKickOffLists( p, o.uri() );
- m_cache[p].append( Variant::fromNode( o ) );
+ Nepomuk::Variant var = Variant::fromNode( o );
+ updateKickOffLists( p, var );
+ m_cache[p].append( var );
}
}
@@ -444,7 +446,7 @@
MAINMODEL->updateProperty( m_uri, uri, value.toNodeList() );
// update the kickofflists
- updateKickOffLists( uri, value.toUrl() );
+ updateKickOffLists( uri, value );
}
}
@@ -459,7 +461,7 @@
MAINMODEL->removeProperty( m_uri, uri );
// update the kickofflists
- updateKickOffLists( uri, QUrl() );
+ updateKickOffLists( uri, Variant() );
}
}
@@ -606,6 +608,8 @@
// Move us to the final data hash now that the URI is known
//
if( !m_uri.isEmpty() ) {
+ //vHanda: Is there some way to avoid this hash lookup every time?
+ // It sure would speed things up.
ResourceDataHash::iterator it = m_rm->m_initializedData.find(m_uri);
if( it == m_rm->m_initializedData.end() ) {
m_rm->m_initializedData.insert( m_uri, this );
@@ -681,11 +685,13 @@
}
-void Nepomuk::ResourceData::updateKickOffLists(const QUrl& prop, const QUrl& newUrl)
+void Nepomuk::ResourceData::updateKickOffLists(const QUrl& prop, const \
Nepomuk::Variant& v) {
KUrl oldUrl;
+ KUrl newUrl;
if( prop == Nepomuk::Vocabulary::NIE::url() ) {
oldUrl = m_nieUrl;
+ newUrl = v.toUrl();
m_nieUrl = newUrl;
}
else if( prop == Soprano::Vocabulary::NAO::identifier() ) {
@@ -695,6 +701,7 @@
break;
}
}
+ newUrl = KUrl( v.toString() );
}
else {
return;
--- trunk/KDE/kdelibs/nepomuk/core/resourcedata.h #1204734:1204735
@@ -184,7 +184,7 @@
void resetAll( bool isDelete = false );
/// Updates both m_kickoffUris and ResourceMangerPrivate's list
- void updateKickOffLists( const QUrl & prop, const QUrl & newUri );
+ void updateKickOffLists( const QUrl & prop, const Variant & v );
/// final resource URI created by determineUri
KUrl m_uri;
--- trunk/KDE/kdelibs/nepomuk/core/resourcemanager.cpp #1204734:1204735
@@ -1,6 +1,7 @@
/*
* This file is part of the Nepomuk KDE project.
* Copyright (C) 2006-2010 Sebastian Trueg <trueg@kde.org>
+ * Copyright (C) 2010 Vishesh Handa <handa.vish@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -179,7 +180,7 @@
{
QMutexLocker lock( &mutex );
- QSet<ResourceData*> rdl = m_uriKickoffData.values().toSet();
+ QSet<ResourceData*> rdl = m_uriKickoffData.values().toSet() + \
m_initializedData.values().toSet(); for( QSet<ResourceData*>::iterator rdIt = \
rdl.begin(); rdIt != rdl.end(); ++rdIt ) {
ResourceData* data = *rdIt;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic