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 OpenGlControlBase: Ensure _updateQueued is set to false when DoCleanup() is called #13260

Merged
merged 1 commit into from Oct 16, 2023

Conversation

laolarou726
Copy link
Contributor

What does the pull request do?

Ensure _updateQueued is set to false when DoCleanup() is called.
Currently, when OpenGlControlBase is detached from the visual tree. Method DoCleanup() will get called immediately.
However, in this method it doesn't set _updateQueued to false, which will fail the following check:

OpenGlControlBase.cs at Line #226:

public void RequestNextFrameRendering()
{
    if ((_initialization == null || _initialization is { Status: TaskStatus.RanToCompletion }) &&
        !_updateQueued) // This check will always failed because _updateQueued is true after DoCleanup()
    {
        _updateQueued = true;
        _compositor?.RequestCompositionUpdate(_update);
    }
}

As the result, the OpenGlControl will never get any frame output after it re-attached to the visual tree.

What is the current behavior?

Now the cleanup method will ensure to set the _updateQueud to false in DoCleanup().

What is the updated/expected behavior with this PR?

Now the control that using OpenGL will still work after the control is re-attached to the visual tree.

@maxkatz6 maxkatz6 added this pull request to the merge queue Oct 16, 2023
Merged via the queue into AvaloniaUI:master with commit 51b7ef4 Oct 16, 2023
6 checks passed
@maxkatz6 maxkatz6 added the backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch label Nov 5, 2023
maxkatz6 pushed a commit that referenced this pull request Dec 5, 2023
@maxkatz6 maxkatz6 added backported-11.0.x and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants