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
+1 -3
View File
@@ -20,7 +20,7 @@ const char *localized_strings_storage[LANGUAGE_COUNT][LOCALIZED_STRING_COUNT] =
[LS_SAVE] = "Speichern",
[LS_SAVE_AS] = "Speichern unter",
[LS_CLOSE_CALENDAR] = "Kalender schließen",
[LS_EXIT] = "Beenden",
[LS_EXIT] = "Beenden###Close",
[LS_VIEW] = "Ansicht",
[LS_LEGEND] = "Legende",
[LS_LANGUAGE] = "Sprache",
@@ -42,7 +42,6 @@ const char *localized_strings_storage[LANGUAGE_COUNT][LOCALIZED_STRING_COUNT] =
[LS_OK] = "Ok",
[LS_CANCEL] = "Abbrechen",
[LS_TITLE_OPEN_PASSWORD] = "Passwort eingeben###Open",
[LS_CLOSE] = "Schließen",
[LS_QUESTION_DO_YOU_REALLY_WANT_TO_QUIT] = "Möchten Sie wirklich beenden?",
[LS_YES] = "Ja",
[LS_NO] = "Nein",
@@ -88,7 +87,6 @@ const char *localized_strings_storage[LANGUAGE_COUNT][LOCALIZED_STRING_COUNT] =
[LS_OK] = "Ok",
[LS_CANCEL] = "Cancel",
[LS_TITLE_OPEN_PASSWORD] = "Enter Password###Open",
[LS_CLOSE] = "Close",
[LS_QUESTION_DO_YOU_REALLY_WANT_TO_QUIT] = "Do you really want to quit?",
[LS_YES] = "Yes",
[LS_NO] = "No",
-1
View File
@@ -41,7 +41,6 @@ enum Localized_String {
LS_OK,
LS_CANCEL,
LS_TITLE_OPEN_PASSWORD,
LS_CLOSE,
LS_QUESTION_DO_YOU_REALLY_WANT_TO_QUIT,
LS_YES,
LS_NO,
+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();