History

move thread safety into Application from caller

howard-stearns committed 10 years ago

Commit d0b58d81 parent ba72dc62 files · +14 −14Browse files

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

Unified · Split

interface/src/Application.cpp+12−8
@@ -5171,19 +5171,23 @@ void Application::toggleLogDialog() { · 5170 unmodified lines
51715171 }
51725172
51735173 void Application::takeSnapshot(bool notify, float aspectRatio) {
5174− QMediaPlayer* player = new QMediaPlayer();
5175− QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
5176− player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
5177− player->play();
5174+ postLambdaEvent([notify, aspectRatio, this] {
5175+ QMediaPlayer* player = new QMediaPlayer();
5176+ QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
5177+ player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
5178+ player->play();
51785179
5179− QString path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio));
5180+ QString path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio));
51805181
5181− emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path, notify);
5182+ emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path, notify);
5183+ });
51825184 }
51835185
51845186 void Application::shareSnapshot(const QString& path) {
5185− // not much to do here, everything is done in snapshot code...
5186− Snapshot::uploadSnapshot(path);
5187+ postLambdaEvent([path] {
5188+ // not much to do here, everything is done in snapshot code...
5189+ Snapshot::uploadSnapshot(path);
5190+ });
51875191 }
51885192
51895193 float Application::getRenderResolutionScale() const {