mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp.git
synced 2025-10-30 08:03:03 +00:00
Close context when showing or hiding a context and reopen afterwards to prevent deadlocks
This commit is contained in:
parent
2e8bd48747
commit
ebd11b2d84
1 changed files with 17 additions and 5 deletions
|
|
@ -796,16 +796,28 @@ void recompui::message_box(const char* msg) {
|
|||
}
|
||||
|
||||
void recompui::show_context(ContextId context, std::string_view param) {
|
||||
std::lock_guard lock{ui_state_mutex};
|
||||
ContextId prev_context = recompui::try_close_current_context();
|
||||
{
|
||||
std::lock_guard lock{ ui_state_mutex };
|
||||
|
||||
// TODO call the context's on_show callback with the param.
|
||||
ui_state->show_context(context);
|
||||
// TODO call the context's on_show callback with the param.
|
||||
ui_state->show_context(context);
|
||||
}
|
||||
if (prev_context != ContextId::null()) {
|
||||
prev_context.open();
|
||||
}
|
||||
}
|
||||
|
||||
void recompui::hide_context(ContextId context) {
|
||||
std::lock_guard lock{ui_state_mutex};
|
||||
ContextId prev_context = recompui::try_close_current_context();
|
||||
{
|
||||
std::lock_guard lock{ ui_state_mutex };
|
||||
|
||||
ui_state->hide_context(context);
|
||||
ui_state->hide_context(context);
|
||||
}
|
||||
if (prev_context != ContextId::null()) {
|
||||
prev_context.open();
|
||||
}
|
||||
}
|
||||
|
||||
void recompui::hide_all_contexts() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue