mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-25 20:56:53 +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"
|
||||
|
||||
struct discHdr *dvdheader = NULL;
|
||||
bool allowUsedSpaceTxtUpdate;
|
||||
|
||||
GameBrowseMenu::GameBrowseMenu()
|
||||
: GuiWindow(screenwidth, screenheight)
|
||||
@ -525,6 +526,7 @@ int GameBrowseMenu::Execute()
|
||||
GameBrowseMenu * Menu = new GameBrowseMenu();
|
||||
mainWindow->Append(Menu);
|
||||
|
||||
allowUsedSpaceTxtUpdate = true;
|
||||
if(Settings.ShowFreeSpace)
|
||||
{
|
||||
ThreadedTask::Instance()->AddCallback(&Menu->HDDSizeCallback);
|
||||
@ -543,6 +545,8 @@ int GameBrowseMenu::Execute()
|
||||
retMenu = Menu->MainLoop();
|
||||
}
|
||||
|
||||
// to avoid that the async thread updates usedSpaceText after menu deletion
|
||||
allowUsedSpaceTxtUpdate = false;
|
||||
delete Menu;
|
||||
|
||||
return retMenu;
|
||||
@ -1689,9 +1693,12 @@ void GameBrowseMenu::UpdateCallback(void * e)
|
||||
|
||||
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" )));
|
||||
}
|
||||
else
|
||||
if ( allowUsedSpaceTxtUpdate == true )
|
||||
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)
|
||||
{
|
||||
float freespace = 0.0, used = 0.0;
|
||||
if ( allowUsedSpaceTxtUpdate == true )
|
||||
usedSpaceTxt->SetVisible(true);
|
||||
int ret = WBFS_DiskSpace(&used, &freespace);
|
||||
if (ret >= 0)
|
||||
|
Loading…
Reference in New Issue
Block a user