1
0
mirror of synced 2025-02-17 18:59:21 +01:00

fix: Occasional error when loading recent files

This commit is contained in:
WerWolv 2023-02-12 17:52:09 +01:00
parent 0b18930017
commit 3003dea409
4 changed files with 15 additions and 6 deletions

View File

@ -36,6 +36,7 @@ namespace hex {
static bool hasPath();
static void clearPath();
static std::fs::path getPath();
static void setPath(const std::fs::path &path);
static void registerHandler(const Handler &handler) {
getHandlers().push_back(handler);

View File

@ -144,9 +144,13 @@ namespace hex {
void ProjectFile::clearPath() {
ProjectFile::s_currProjectPath.clear();
}
std::fs::path ProjectFile::getPath() {
return ProjectFile::s_currProjectPath;
}
void ProjectFile::setPath(const std::fs::path &path) {
ProjectFile::s_currProjectPath = path;
}
}

View File

@ -816,9 +816,6 @@ namespace hex {
void Window::exitImGui() {
delete static_cast<ImGui::ImHexCustomData *>(ImGui::GetIO().UserData);
ImNodes::PopAttributeFlag();
ImNodes::PopAttributeFlag();
ImGui::SaveIniSettingsToDisk(hex::toUTF8String(this->m_imguiSettingsPath).c_str());
ImGui_ImplOpenGL3_Shutdown();

View File

@ -480,8 +480,15 @@ namespace hex::plugin::builtin {
if (!recentFile.isValid())
continue;
if (auto settings = provider->storeSettings(); !settings.is_null())
recentFile.write(settings.dump(4));
{
auto path = ProjectFile::getPath();
ProjectFile::clearPath();
if (auto settings = provider->storeSettings(); !settings.is_null())
recentFile.write(settings.dump(4));
ProjectFile::setPath(path);
}
}
}