mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-17 00:39:17 +01:00
solve DSI due to async update of usedSizeTxt after the menu was deleted
This commit is contained in:
parent
92a412ffd5
commit
d507ba5ed1
@ -40,6 +40,7 @@
|
|||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
struct discHdr *dvdheader = NULL;
|
struct discHdr *dvdheader = NULL;
|
||||||
|
bool allowUsedSpaceTxtUpdate;
|
||||||
|
|
||||||
GameBrowseMenu::GameBrowseMenu()
|
GameBrowseMenu::GameBrowseMenu()
|
||||||
: GuiWindow(screenwidth, screenheight)
|
: GuiWindow(screenwidth, screenheight)
|
||||||
@ -525,6 +526,7 @@ int GameBrowseMenu::Execute()
|
|||||||
GameBrowseMenu * Menu = new GameBrowseMenu();
|
GameBrowseMenu * Menu = new GameBrowseMenu();
|
||||||
mainWindow->Append(Menu);
|
mainWindow->Append(Menu);
|
||||||
|
|
||||||
|
allowUsedSpaceTxtUpdate = true;
|
||||||
if(Settings.ShowFreeSpace)
|
if(Settings.ShowFreeSpace)
|
||||||
{
|
{
|
||||||
ThreadedTask::Instance()->AddCallback(&Menu->HDDSizeCallback);
|
ThreadedTask::Instance()->AddCallback(&Menu->HDDSizeCallback);
|
||||||
@ -543,6 +545,8 @@ int GameBrowseMenu::Execute()
|
|||||||
retMenu = Menu->MainLoop();
|
retMenu = Menu->MainLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to avoid that the async thread updates usedSpaceText after menu deletion
|
||||||
|
allowUsedSpaceTxtUpdate = false;
|
||||||
delete Menu;
|
delete Menu;
|
||||||
|
|
||||||
return retMenu;
|
return retMenu;
|
||||||
@ -1689,9 +1693,12 @@ void GameBrowseMenu::UpdateCallback(void * e)
|
|||||||
|
|
||||||
void GameBrowseMenu::SetFreeSpace(float freespace, float used)
|
void GameBrowseMenu::SetFreeSpace(float freespace, float used)
|
||||||
{
|
{
|
||||||
if (strcmp(Settings.db_language, "JA") == 0)
|
if (strcmp(Settings.db_language, "JA") == 0) {
|
||||||
|
if ( allowUsedSpaceTxtUpdate == true )
|
||||||
usedSpaceTxt->SetText(fmt("%.2fGB %s %.2fGB %s", freespace + used, tr( "of" ), freespace, tr( "free" )));
|
usedSpaceTxt->SetText(fmt("%.2fGB %s %.2fGB %s", freespace + used, tr( "of" ), freespace, tr( "free" )));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
if ( allowUsedSpaceTxtUpdate == true )
|
||||||
usedSpaceTxt->SetText(fmt("%.2fGB %s %.2fGB %s", freespace, tr( "of" ), freespace + used, tr( "free" )));
|
usedSpaceTxt->SetText(fmt("%.2fGB %s %.2fGB %s", freespace, tr( "of" ), freespace + used, tr( "free" )));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1700,6 +1707,7 @@ void GameBrowseMenu::UpdateFreeSpace(void * arg)
|
|||||||
if (Settings.ShowFreeSpace)
|
if (Settings.ShowFreeSpace)
|
||||||
{
|
{
|
||||||
float freespace = 0.0, used = 0.0;
|
float freespace = 0.0, used = 0.0;
|
||||||
|
if ( allowUsedSpaceTxtUpdate == true )
|
||||||
usedSpaceTxt->SetVisible(true);
|
usedSpaceTxt->SetVisible(true);
|
||||||
int ret = WBFS_DiskSpace(&used, &freespace);
|
int ret = WBFS_DiskSpace(&used, &freespace);
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user