History

Fixed invokeMethod unable to find method + fixed children in different thread

Atlante45 committed 12 years ago

Commit 8e1b8331 parent 37294284 files · +30 −9Browse files

Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all

Unified · Split

interface/src/Application.cpp+7−4
@@ -316,11 +316,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 315 unmodified lines
316316 QString cachePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
317317
318318 NetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
319− QNetworkDiskCache* cache = new QNetworkDiskCache(&networkAccessManager);
319+
320+ // Make sure cache on same thread than its parent (NetworkAccessManager)
321+ QNetworkDiskCache* cache = new QNetworkDiskCache();
322+ cache->moveToThread(networkAccessManager.thread());
323+ cache->setParent(&networkAccessManager);
324+
320325 cache->setCacheDirectory(!cachePath.isEmpty() ? cachePath : "interfaceCache");
321− QMetaObject::invokeMethod(&networkAccessManager, "setCache",
322− Qt::BlockingQueuedConnection,
323− Q_ARG(QAbstractNetworkCache*, cache));
326+ networkAccessManager.setCache(cache);
324327
325328 ResourceCache::setRequestLimit(3);
326329

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t