Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect assertion and possible nullref #6293

Merged
merged 1 commit into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions osu.Framework/Graphics/UserInterface/TextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1377,20 +1377,21 @@ private void bindInput([CanBeNull] TextBox previous)

private void unbindInput([CanBeNull] TextBox next)
{
Debug.Assert(textInput != null);

if (!textInputBound)
return;

textInputBound = false;

// see the comment above, in `bindInput(bool)`.
if (next?.textInput != textInput)
textInput.Deactivate();
if (textInput != null)
{
// see the comment above, in `bindInput(bool)`.
if (next?.textInput != textInput)
textInput.Deactivate();

textInput.OnTextInput -= handleTextInput;
textInput.OnImeComposition -= handleImeComposition;
textInput.OnImeResult -= handleImeResult;
textInput.OnTextInput -= handleTextInput;
textInput.OnImeComposition -= handleImeComposition;
textInput.OnImeResult -= handleImeResult;
}

// in case keys are held and we lose focus, we should no longer block key events
textInputBlocking = false;
Expand Down
Loading