History

Fix snapshots freezing Interface when no snap directory defined

sabrina-shanman committed 7 years ago

Commit ef1ff211 parent 9261df51 file · +16 −14Browse files

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

Unified · Split

interface/src/Application.cpp+16−14
@@ -8456,28 +8456,30 @@ bool Application::takeSnapshotOperators(std::queue<SnapshotOperator>& snapshotOp · 8455 unmodified lines
84568456
84578457 void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio, const QString& filename) {
84588458 addSnapshotOperator(std::make_tuple([notify, includeAnimated, aspectRatio, filename](const QImage& snapshot) {
8459− QString path = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());
8460−
8461− // If we're not doing an animated snapshot as well...
8462− if (!includeAnimated) {
8463− if (!path.isEmpty()) {
8464− // Tell the dependency manager that the capture of the still snapshot has taken place.
8465− emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify);
8466− }
8467− } else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) {
8468− qApp->postLambdaEvent([path, aspectRatio] {
8459+ qApp->postLambdaEvent([snapshot, notify, includeAnimated, aspectRatio, filename] {
8460+ QString path = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());
8461+
8462+ // If we're not doing an animated snapshot as well...
8463+ if (!includeAnimated) {
8464+ if (!path.isEmpty()) {
8465+ // Tell the dependency manager that the capture of the still snapshot has taken place.
8466+ emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify);
8467+ }
8468+ } else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) {
84698469 // Get an animated GIF snapshot and save it
84708470 SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, DependencyManager::get<WindowScriptingInterface>());
8471− });
8472− }
8471+ }
8472+ });
84738473 }, aspectRatio, true));
84748474 }
84758475
84768476 void Application::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) {
84778477 addSnapshotOperator(std::make_tuple([notify, filename](const QImage& snapshot) {
8478− QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());
8478+ qApp->postLambdaEvent([snapshot, notify, filename] {
8479+ QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());
84798480
8480− emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify);
8481+ emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify);
8482+ });
84818483 }, 0.0f, false));
84828484 }
84838485