the source of the random crashes?!
This commit is contained in:
+19
-3
@@ -8,6 +8,7 @@
|
||||
#include "file.hpp"
|
||||
#include "path.hpp"
|
||||
#include "sdl.hpp"
|
||||
#include "strings.hpp"
|
||||
#include "time.hpp"
|
||||
|
||||
#if _WIN32
|
||||
@@ -24,8 +25,23 @@ namespace anm2ed
|
||||
void Logger::write_raw(const std::string& message)
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
std::println("{}", message);
|
||||
if (!logPath.empty()) file::write_string(logPath, message + '\n', "ab");
|
||||
try
|
||||
{
|
||||
std::println("{}", message);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
if (!logPath.empty())
|
||||
{
|
||||
try
|
||||
{
|
||||
file::write_string(logPath, message + '\n', "ab");
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Logger::write(const Level level, const std::string& message)
|
||||
@@ -144,7 +160,7 @@ namespace anm2ed
|
||||
Logger::Logger()
|
||||
{
|
||||
open(path());
|
||||
info("Initializing Anm2Ed");
|
||||
info(std::format("Initializing {}", localize.get(LABEL_APPLICATION_NAME, ENGLISH)));
|
||||
}
|
||||
|
||||
Logger::~Logger()
|
||||
|
||||
+23
-1
@@ -8,6 +8,28 @@ namespace anm2ed
|
||||
{
|
||||
int SnapshotStack::maxSize = snapshots::MAX;
|
||||
|
||||
Snapshot Snapshot::stack_copy_get() const
|
||||
{
|
||||
Snapshot out{};
|
||||
out.playback = playback;
|
||||
out.animation = animation;
|
||||
out.event = event;
|
||||
out.frames = frames;
|
||||
out.items = items;
|
||||
out.layer = layer;
|
||||
out.merge = merge;
|
||||
out.null = null;
|
||||
out.region = region;
|
||||
out.sound = sound;
|
||||
out.spritesheet = spritesheet;
|
||||
out.textures = textures;
|
||||
out.anm2 = anm2;
|
||||
out.reference = reference;
|
||||
out.frameTime = frameTime;
|
||||
out.message = message;
|
||||
return out;
|
||||
}
|
||||
|
||||
bool SnapshotStack::is_empty() { return stack.empty(); }
|
||||
|
||||
void SnapshotStack::push(const Snapshot& snapshot)
|
||||
@@ -18,7 +40,7 @@ namespace anm2ed
|
||||
return;
|
||||
}
|
||||
if ((int)stack.size() >= maxSize) stack.pop_front();
|
||||
stack.push_back(snapshot);
|
||||
stack.push_back(snapshot.stack_copy_get());
|
||||
}
|
||||
|
||||
std::optional<Snapshot> SnapshotStack::pop()
|
||||
|
||||
@@ -38,6 +38,8 @@ namespace anm2ed
|
||||
Reference reference{};
|
||||
float frameTime{};
|
||||
std::string message = snapshots::ACTION;
|
||||
|
||||
Snapshot stack_copy_get() const;
|
||||
};
|
||||
|
||||
class SnapshotStack
|
||||
|
||||
Reference in New Issue
Block a user