fix some memory issues
This commit is contained in:
parent
a377bf6f00
commit
4a99882118
2 changed files with 7 additions and 3 deletions
|
@ -191,10 +191,12 @@ uint8* USkyPortalIO::QueryBlock(uint8 FigureIndex, uint8 BlockIndex)
|
|||
command.data[3] = BlockIndex;
|
||||
unsigned char* output = nullptr;
|
||||
int attempt=0;
|
||||
bool write;
|
||||
do {
|
||||
attempt++;
|
||||
UE_LOG(LogSkyportalIO, Verbose, TEXT("Trying to write... attempt:%d"), attempt);
|
||||
if (Write(&command)) {
|
||||
write = Write(&command);
|
||||
if (write) {
|
||||
output = Read();
|
||||
if (output != nullptr && output != 0) {
|
||||
UE_LOG(LogSkyportalIO, Verbose, TEXT("Read success: output[0]=%d, output[1]=%d, output[2]=%d"), output[0], output[1], output[2]);
|
||||
|
@ -204,7 +206,7 @@ uint8* USkyPortalIO::QueryBlock(uint8 FigureIndex, uint8 BlockIndex)
|
|||
}
|
||||
}
|
||||
|
||||
} while ((output[0] != 'Q' || (output[1] % 0x10 != FigureIndex && output[1] != 0x01) || output[2] != BlockIndex) && attempt < 10);
|
||||
} while (write == false && (output[0] != 'Q' || (output[1] % 0x10 != FigureIndex && output[1] != 0x01) || output[2] != BlockIndex) && attempt < 10);
|
||||
UE_LOG(LogSkyportalIO, Verbose, TEXT("Querying block %d - success"), BlockIndex);
|
||||
UE_LOG(LogSkyportalIO, VeryVerbose, TEXT("Data block %d = \n %s"), BlockIndex,*OutputToString(output));
|
||||
return output;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "HAL/RunnableThread.h"
|
||||
#include "SkyPortalFigure.h"
|
||||
#include <Async/TaskGraphInterfaces.h>
|
||||
#include <Async/Async.h>
|
||||
|
||||
|
||||
void USkyPortalSubsystem::Initialize(FSubsystemCollectionBase& Collection)
|
||||
|
@ -259,7 +261,7 @@ bool USkyPortalSubsystem::IsPortalReady()
|
|||
void USkyPortalSubsystem::PortalAnalyzeAsync(const uint8 Index)
|
||||
{
|
||||
bShouldPauseRunner = true;
|
||||
UE_LOG(LogSkyportalIO, Log, TEXT("Starting async figure analysis..."));
|
||||
UE_LOG(LogSkyportalIO, Log, TEXT("Starting async figure analysis for index %d..."), Index);
|
||||
|
||||
// Run the PortalAnalyze function asynchronously on a background thread
|
||||
AsyncTask(ENamedThreads::AnyBackgroundThreadNormalTask, [this, Index]()
|
||||
|
|
Loading…
Reference in a new issue