Skip to content

Commit

Permalink
Fix memory corruption when application is ending
Browse files Browse the repository at this point in the history
  • Loading branch information
Lecrapouille committed Jan 6, 2024
1 parent 84dc4f4 commit b4a59ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
8 changes: 8 additions & 0 deletions data/imgui.ini
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ Column 0 Sort=0v
RefScale=13
Column 0 Sort=0v

[Table][0x9B8096DD,4]
RefScale=13
Column 0 Sort=0v

[Table][0x7A58EED9,4]
RefScale=13
Column 0 Sort=0v

[Docking][Data]
DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,19 Size=1024,749 Split=Y
DockNode ID=0x00000003 Parent=0x8B93E3BD SizeRef=1024,681 Split=X
Expand Down
8 changes: 6 additions & 2 deletions src/Editor/PetriEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@

namespace tpne {

//! \brief path of the file storing dear imgui widgets. Cannot be placed
//! as member variable of Editor class.
static std::string g_ini_filename = "imgui.ini";

//--------------------------------------------------------------------------
Editor::Editor(size_t const width, size_t const height,
std::string const& title)
Expand All @@ -53,8 +57,8 @@ void Editor::startUp(std::string const& filepath)

// Set imgui.ini loading/saving location
ImGuiIO &io = ImGui::GetIO();
m_states.ini_filename = m_path.expand("imgui.ini").c_str();
io.IniFilename = m_states.ini_filename.c_str();
g_ini_filename = m_path.expand("imgui.ini").c_str();
io.IniFilename = g_ini_filename.c_str();
std::cout << "imgui.ini path: " << io.IniFilename << std::endl;

// Setup fonts
Expand Down
1 change: 0 additions & 1 deletion src/Editor/PetriEditor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class Editor: public Application
ImVec2 viewport_center;
std::string title;
bool request_quitting = false;
std::string ini_filename = "imgui.ini";
};

// ************************************************************************
Expand Down

0 comments on commit b4a59ef

Please sign in to comment.