Merge pull request 'fix deletion of dialog' (#68) from bugfix/segmentationfault into master

Reviewed-on: #68
This commit is contained in:
Hendrik Schutter 2024-06-23 11:13:53 +02:00
commit 6dd4c44688

View File

@ -613,6 +613,7 @@ void TUI::vTruncateText(string *psText, uint16_t u16MaxLenght)
void TUI::displaySelectedDrive(Drive drive, int stdscrX, int stdscrY)
{
struct MenuState menustate;
static bool dialogIsActive;
menustate.bAbort = false;
menustate.bConfirmDelete = false;
menustate.bConfirmShred = false;
@ -659,15 +660,21 @@ void TUI::displaySelectedDrive(Drive drive, int stdscrX, int stdscrY)
{
dialog = createDialog(40, 10, ((stdscrX) - (int)(stdscrX / 3) - 7) - (int)((stdscrX / 3) + 5) / 2, (int)(stdscrY / 2) - 5, "Confirm SHRED", "Press ENTER for SHRED", "Press ESC for cancel");
wrefresh(dialog);
dialogIsActive = true;
}
else if (menustate.bConfirmDelete == true)
{
dialog = createDialog(40, 10, ((stdscrX) - (int)(stdscrX / 3) - 7) - (int)((stdscrX / 3) + 5) / 2, (int)(stdscrY / 2) - 5, "Confirm DELETE", "Press ENTER for DELETE", "Press ESC for cancel");
wrefresh(dialog);
dialogIsActive = true;
}
else
{
delwin(dialog);
if (dialogIsActive)
{
delwin(dialog);
dialogIsActive = false;
}
}
}