fix save_file_path allocation when open calendar is canceled

remove LS_CLOSE

#9
This commit is contained in:
2026-05-23 15:23:57 +02:00
parent 37f54f3dee
commit 8b1ed44bc9
3 changed files with 9 additions and 10 deletions
+8 -6
View File
@@ -300,7 +300,7 @@ void per_frame(){
}
ImGui::DockSpaceOverViewport(main_viewport_dock, ImGui::GetMainViewport(), ImGuiDockNodeFlags_NoTabBar);
ImGuiID close_popup = ImGui::GetID("Close");
ImGuiID close_popup = ImGui::GetID("###Close");
ImGuiID save_password_popup = ImGui::GetID("###Save");
ImGuiID open_password_popup = ImGui::GetID("###Open");
@@ -333,7 +333,7 @@ void per_frame(){
//TODO if calendar is opened warning
if (save_file_path) free(save_file_path);
save_file_path = NULL;
save_file_path = (char *)calloc(1, 1);
num_categories = 0;
num_categorized_days = 0;
hydro_memzero(categories, sizeof(categories));
@@ -344,7 +344,9 @@ void per_frame(){
ImGui::Separator();
if (ImGui::MenuItem(get_localized_string(LS_EXIT), NULL)) {
ImGui::OpenPopup(close_popup);
if(unsaved_changes)
ImGui::OpenPopup(close_popup);
should_exit = true;
}
ImGui::EndMenu();
}
@@ -440,7 +442,7 @@ void per_frame(){
ImGui::SameLine();
if (ImGui::Button(get_localized_string(LS_CANCEL), ImVec2(120, 0))) {
if (save_file_path) free(save_file_path);
save_file_path = NULL;
save_file_path = (char *)calloc(1, 1);
ImGui::CloseCurrentPopup();
hydro_memzero(password_input_buffer, sizeof(password_input_buffer));
}
@@ -448,9 +450,9 @@ void per_frame(){
ImGui::EndPopup();
}
// close application modal dialogue
// close calendar modal dialogue
ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
if (ImGui::BeginPopupModal(get_localized_string(LS_CLOSE), NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize)) {
if (ImGui::BeginPopupModal(get_localized_string(LS_EXIT), NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Text("%s", get_localized_string(LS_QUESTION_DO_YOU_REALLY_WANT_TO_QUIT));
ImGui::SetItemDefaultFocus();