[Marble-commits] KDE/kdeedu/marble/src/lib
Bastian Holst
bastianholst at gmx.de
Sat Jul 18 16:44:54 CEST 2009
SVN commit 998775 by bholst:
Fixed Marble DataPlugin crash activated by 998750.
M +1 -0 AbstractDataPlugin.cpp
M +11 -10 AbstractDataPluginModel.cpp
M +2 -0 CacheStoragePolicy.cpp
M +2 -0 CacheStoragePolicy.h
--- trunk/KDE/kdeedu/marble/src/lib/AbstractDataPlugin.cpp #998774:998775
@@ -35,6 +35,7 @@
}
~AbstractDataPluginPrivate() {
+ delete m_model;
}
AbstractDataPluginModel *m_model;
--- trunk/KDE/kdeedu/marble/src/lib/AbstractDataPluginModel.cpp #998774:998775
@@ -75,9 +75,7 @@
(*hIt)->deleteLater();
}
- m_storagePolicy->clearCache();
- delete m_storagePolicy;
-
+ m_downloadManager->storagePolicy()->clearCache();
delete m_downloadManager;
}
@@ -95,8 +93,7 @@
QTimer *m_downloadTimer;
quint32 m_descriptionFileNumber;
QHash<QString, QVariant> m_itemSettings;
-
- CacheStoragePolicy *m_storagePolicy;
+
HttpDownloadManager *m_downloadManager;
};
@@ -105,10 +102,10 @@
d( new AbstractDataPluginModelPrivate( name, this ) )
{
// Initializing file and download System
- d->m_storagePolicy = new CacheStoragePolicy( MarbleDirs::localPath()
- + "/cache/" + d->m_name + '/' );
+ CacheStoragePolicy *storagePolicy = new CacheStoragePolicy( MarbleDirs::localPath()
+ + "/cache/" + d->m_name + '/' );
d->m_downloadManager = new HttpDownloadManager( QUrl(),
- d->m_storagePolicy );
+ storagePolicy );
connect( d->m_downloadManager, SIGNAL( downloadComplete( QString, QString ) ),
this, SLOT( processFinishedJob( QString , QString ) ) );
@@ -319,7 +316,7 @@
}
bool AbstractDataPluginModel::fileExists( const QString& fileName ) const {
- return d->m_storagePolicy->fileExists( fileName );
+ return d->m_downloadManager->storagePolicy()->fileExists( fileName );
}
bool AbstractDataPluginModel::fileExists( const QString& id, const QString& type ) const {
@@ -399,7 +396,11 @@
Q_UNUSED( relativeUrlString );
if( id.startsWith( descriptionPrefix ) ) {
- parseFile( d->m_storagePolicy->data( id ) );
+ CacheStoragePolicy *storagePolicy
+ = qobject_cast<CacheStoragePolicy*>( d->m_downloadManager->storagePolicy() );
+ if ( storagePolicy ) {
+ parseFile( storagePolicy->data( id ) );
+ }
}
else {
// The downloaded file contains item data.
--- trunk/KDE/kdeedu/marble/src/lib/CacheStoragePolicy.cpp #998774:998775
@@ -70,3 +70,5 @@
{
return m_cache.cacheLimit();
}
+
+#include "CacheStoragePolicy.moc"
--- trunk/KDE/kdeedu/marble/src/lib/CacheStoragePolicy.h #998774:998775
@@ -24,6 +24,8 @@
class MARBLE_EXPORT CacheStoragePolicy : public StoragePolicy
{
+ Q_OBJECT
+
public:
/**
* Creates a new cache storage policy.
More information about the Marble-commits
mailing list