1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

Fix crash on closing game during background image upscaling

This commit is contained in:
Ivan Savenko
2025-03-12 14:18:44 +00:00
parent 6855b895a0
commit 96d691b40c
10 changed files with 71 additions and 24 deletions

View File

@@ -20,6 +20,7 @@
#include "../GameEngine.h"
#include "../render/IScreenHandler.h"
#include "../../lib/AsyncRunner.h"
#include "../../lib/CConfigHandler.h"
#include <tbb/parallel_for.h>
@@ -256,8 +257,6 @@ std::shared_ptr<const ISharedImage> SDLImageShared::scaleInteger(int factor, SDL
SDLImageShared::SDLImageShared(const SDLImageShared * from, int integerScaleFactor, EScalingAlgorithm algorithm)
{
static tbb::task_arena upscalingArena;
upscalingInProgress = true;
auto scaler = std::make_shared<SDLImageScaler>(from->surf, Rect(from->margins, from->fullSize), true);
@@ -273,7 +272,7 @@ SDLImageShared::SDLImageShared(const SDLImageShared * from, int integerScaleFact
};
if(settings["video"]["asyncUpscaling"].Bool())
upscalingArena.enqueue(scalingTask);
ENGINE->async().run(scalingTask);
else
scalingTask();
}