Skip to content

Commit 0494848

Browse files
committed
FullscreenUI: Remove redundant is_initialized variable
1 parent af5ec7f commit 0494848

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/core/fullscreenui_achievements.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2842,7 +2842,10 @@ void FullscreenUI::LeaderboardFetchNearbyCallback(int result, const char* error_
28422842

28432843
if (result != RC_OK)
28442844
{
2845-
ShowToast(OSDMessageType::Error, TRANSLATE_STR("Achievements", "Leaderboard download failed"), error_message);
2845+
VideoThread::RunOnThread([error_message = std::string(error_message)]() mutable {
2846+
ShowToast(OSDMessageType::Error, TRANSLATE_STR("Achievements", "Leaderboard download failed"),
2847+
std::move(error_message));
2848+
});
28462849
CloseLeaderboard();
28472850
return;
28482851
}
@@ -2862,7 +2865,10 @@ void FullscreenUI::LeaderboardFetchAllCallback(int result, const char* error_mes
28622865

28632866
if (result != RC_OK)
28642867
{
2865-
ShowToast(OSDMessageType::Error, TRANSLATE_STR("Achievements", "Leaderboard download failed"), error_message);
2868+
VideoThread::RunOnThread([error_message = std::string(error_message)]() mutable {
2869+
ShowToast(OSDMessageType::Error, TRANSLATE_STR("Achievements", "Leaderboard download failed"),
2870+
std::move(error_message));
2871+
});
28662872
CloseLeaderboard();
28672873
return;
28682874
}

src/core/fullscreenui_widgets.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ struct WidgetsState
334334
{
335335
std::recursive_mutex shared_state_mutex;
336336

337-
bool has_initialized = false; // used to prevent notification queuing without GPU device
338337
CloseButtonState close_button_state = CloseButtonState::None;
339338
FocusResetType focus_reset_queued = FocusResetType::None;
340339
TransitionState transition_state = TransitionState::Inactive;
@@ -427,7 +426,6 @@ bool FullscreenUI::InitializeWidgets(Error* error)
427426

428427
UpdateWidgetsSettings();
429428

430-
s_state.has_initialized = true;
431429
return true;
432430
}
433431

@@ -456,8 +454,6 @@ void FullscreenUI::ShutdownWidgets()
456454
s_state.file_selector_dialog.ClearState();
457455
}
458456

459-
s_state.has_initialized = false;
460-
461457
UIStyle.Font = nullptr;
462458

463459
UpdateLoadingScreenRunIdle();
@@ -5649,8 +5645,10 @@ std::pair<ImVec2, float> FullscreenUI::NotificationLayout::GetNextPosition(float
56495645

56505646
void FullscreenUI::ShowToast(OSDMessageType type, std::string title, std::string message)
56515647
{
5652-
const std::unique_lock lock(s_state.shared_state_mutex);
5653-
if (!s_state.has_initialized)
5648+
DebugAssert(VideoThread::IsOnThread());
5649+
5650+
// Don't queue toasts if we're not initialized, since it'll never clear.
5651+
if (!s_state.transition_blend_pipeline)
56545652
return;
56555653

56565654
const bool prev_had_notifications = AreAnyNotificationsActive();

0 commit comments

Comments
 (0)