mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Temporary fix to disk cache editor crash
This commit is contained in:
parent
2c1762526d
commit
40d307a37b
4 changed files with 16 additions and 8 deletions
|
@ -1072,10 +1072,8 @@ void Application::cleanupBeforeQuit() {
|
|||
}
|
||||
|
||||
void Application::emptyLocalCache() {
|
||||
if (auto cache = NetworkAccessManager::getInstance().cache()) {
|
||||
qDebug() << "DiskCacheEditor::clear(): Clearing disk cache.";
|
||||
cache->clear();
|
||||
}
|
||||
auto assetClient = DependencyManager::get<AssetClient>();
|
||||
QMetaObject::invokeMethod(assetClient.data(), "clearCache", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
Application::~Application() {
|
||||
|
|
|
@ -122,6 +122,7 @@ void DiskCacheEditor::refresh() {
|
|||
}
|
||||
return QString("%0 %1").arg(number).arg(UNITS[i]);
|
||||
};
|
||||
return;
|
||||
QNetworkDiskCache* cache = qobject_cast<QNetworkDiskCache*>(NetworkAccessManager::getInstance().cache());
|
||||
|
||||
if (_path) {
|
||||
|
@ -135,6 +136,7 @@ void DiskCacheEditor::refresh() {
|
|||
}
|
||||
}
|
||||
|
||||
#include <AssetClient.h>
|
||||
void DiskCacheEditor::clear() {
|
||||
QMessageBox::StandardButton buttonClicked =
|
||||
OffscreenUi::question(_dialog, "Clearing disk cache",
|
||||
|
@ -142,10 +144,8 @@ void DiskCacheEditor::clear() {
|
|||
"are you sure you want to do that?",
|
||||
QMessageBox::Ok | QMessageBox::Cancel);
|
||||
if (buttonClicked == QMessageBox::Ok) {
|
||||
if (auto cache = NetworkAccessManager::getInstance().cache()) {
|
||||
qDebug() << "DiskCacheEditor::clear(): Clearing disk cache.";
|
||||
cache->clear();
|
||||
}
|
||||
auto assetClient = DependencyManager::get<AssetClient>();
|
||||
QMetaObject::invokeMethod(assetClient.data() , "clearCache", Qt::QueuedConnection);
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
|
|
|
@ -64,6 +64,15 @@ void AssetClient::init() {
|
|||
}
|
||||
}
|
||||
|
||||
void AssetClient::clearCache() {
|
||||
Q_ASSERT(QThread::currentThread() == thread());
|
||||
|
||||
if (auto cache = NetworkAccessManager::getInstance().cache()) {
|
||||
qDebug() << "AssetClient::clearCache(): Clearing disk cache.";
|
||||
cache->clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool haveAssetServer() {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void init();
|
||||
void clearCache();
|
||||
|
||||
private slots:
|
||||
void handleAssetGetInfoReply(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
|
||||
|
|
Loading…
Reference in a new issue