mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 00:47:20 +08:00
Fix CurrentDialog
being updated twice, unsafe variable access
This commit is contained in:
parent
a27fcda9f1
commit
326ff3b6e9
@ -50,17 +50,17 @@ namespace osu.Game.Overlays
|
|||||||
if (dialog == CurrentDialog || dialog.State.Value != Visibility.Visible) return;
|
if (dialog == CurrentDialog || dialog.State.Value != Visibility.Visible) return;
|
||||||
|
|
||||||
var lastDialog = CurrentDialog;
|
var lastDialog = CurrentDialog;
|
||||||
|
|
||||||
|
// Immediately update the externally accessible property as this may be used for checks even before
|
||||||
|
// a DialogOverlay instance has finished loading.
|
||||||
CurrentDialog = dialog;
|
CurrentDialog = dialog;
|
||||||
|
|
||||||
Scheduler.Add(() =>
|
Scheduler.Add(() =>
|
||||||
{
|
{
|
||||||
// if any existing dialog is being displayed, dismiss it before showing a new one.
|
// if any existing dialog is being displayed, dismiss it before showing a new one.
|
||||||
lastDialog?.Hide();
|
lastDialog?.Hide();
|
||||||
|
dialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue);
|
||||||
CurrentDialog = dialog;
|
dialogContainer.Add(dialog);
|
||||||
CurrentDialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue);
|
|
||||||
|
|
||||||
dialogContainer.Add(CurrentDialog);
|
|
||||||
|
|
||||||
Show();
|
Show();
|
||||||
}, false);
|
}, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user